如何添加对 libasound2-plugin-equal 的支持到 ASLA 配置 raspnerry pi MAX98357 I2S amp

如何添加对 libasound2-plugin-equal 的支持到 ASLA 配置 raspnerry pi MAX98357 I2S amp

我已经按照本教程进行了操作(https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp/raspberry-pi-usage)将 MAX98357 I2S 放大器添加到树莓派。它工作得很棒,但我想要一个软件均衡器来调整高点和低点。我似乎无法确定使用ASLA 的包插件/etc/asound.conf来实现这一点所需的配置。libasound2-plugin-equal有什么建议么?

这是我所拥有的,以及我尝试过的评论

pcm.speakerbonnet {
   type hw card 0
}

pcm.dmixer {
   type dmix
   ipc_key 1024
   ipc_perm 0666
   slave {
     pcm "speakerbonnet"
     period_time 0
     period_size 1024
     buffer_size 8192
     rate 44100
     channels 2
   }
}

ctl.dmixer {
    type hw card 0
}

pcm.softvol {
    type softvol
    slave.pcm "dmixer"
    control.name "PCM"
    control.card 0
}

ctl.softvol {
    type hw card 0
}




pcm.!default {
    type             plug

    # this works (ie not using eq)
    #slave.pcm       "softvol"

    # tried setting this to plugin, but this fails to produce sound
    slave.pcm        plugequal
}



# attempt to get libasound2-plugin-equal working
ctl.equal {
  type equal
}
pcm.plugequal {
  type equal
  slave.pcm "dmixer"
}
pcm.equal {
  type plug
  slave.pcm plugequal
}

通过上面的配置,我得到以下结果

pi@pi:~ $ speaker-test -c2 --test=wav -w /usr/share/sounds/alsa/Front_Center.wav

speaker-test 1.1.8

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
ALSA lib pcm_params.c:2226:(snd1_pcm_hw_refine_slave) Slave PCM not usable
Broken configuration for playback: no configurations available: No such file or directory
Setting of hwparams failed: No such file or directory
pi@pi:~ $ 
pi@pi:~ $ mpg123 /tmp/test_song.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
    version 1.25.10; written and copyright by Michael Hipp and others
    free software (LGPL) without any warranty but with best wishes
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available
[src/libout123/modules/alsa.c:204] error: get_formats_alsa(): no configuration available

Directory: /tmp/

Terminal control enabled, press 'h' for listing of keys and functions.

Playing MPEG stream 1 of 1: test_song.mp3 ...
[src/libout123/modules/alsa.c:80] error: initialize_device(): no configuration available
main: [src/mpg123.c:309] error: out123 error 7: failed to open device
pi@pi:~ $

答案1

解决方案是设置slave.pmc "plug:dmix"

pcm.speakerbonnet {
   type hw card 0
}

pcm.dmixer {
   type dmix
   ipc_key 1024
   ipc_perm 0666
   slave {
     pcm "speakerbonnet"
     period_time 0
     period_size 1024
     buffer_size 8192
     rate 44100
     channels 2
   }
}

ctl.dmixer {
    type hw card 0
}

pcm.softvol {
    type softvol
    slave.pcm "dmixer"
    control.name "PCM"
    control.card 0
}

ctl.softvol {
    type hw card 0
}




pcm.!default {
    type             plug
    #slave.pcm       "softvol"
    slave.pcm        plugequal
}



# attempt to get libasound2-plugin-equal working
ctl.equal {
  type equal
}
pcm.plugequal {
  type equal
  slave.pcm "plug:dmix"
}
pcm.equal {
  type plug
  slave.pcm plugequal
}

相关内容