Quantcast
Viewing all articles
Browse latest Browse all 4829

Troubleshooting • Weird problems with ALSA and volume configuration

I'm working on a project involving a Raspberry Pi Zero 2W that plays sound through an Adafruit MAX98357A I2S-based amplifier. Adafruit provides a setup script (i2samp.py, available here: https://github.com/adafruit/Raspberry-P ... /i2samp.py) that needs to be run with sudo.

After installation, I could play sound as su (sudo aplay file.wav), or as pi while specifying the driver (aplay -D plug:softvol file.wav). However, in both cases, the volume level was pegged to maximum. The card has a value in alsactl and a slider in alsamixer, but it was stuck at 100 and could not be changed.

/etc/asound.conf is configured (by i2samp.py) like this:

Code:

pcm.speakerbonnet {   type hw card 0}ctl.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"}
Something in there seems to be incorrect. I found that if I change control.name "PCM" in pcm.softvol to anything else, I can now change the value of volume of PCM for the adapter, but it doesn't affect the output volume. Also, if I change slave.pcm "dmixer" to any other value, volume control actually works to control the volume - but only for the superuser account, but trying to play sound as pi (via aplay -D plug:softvol file.wav) now fails with the error message: ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave (which makes sense since pcm.softvol no longer has a valid slave target, but I'm puzzled as to why running the same command as su works).

I'm reviewing the ALSA documentation (https://alsa.opensrc.org/How_to_use_sof ... ter_volume) and particularly the examples for other variations I can try, but I'm coming up empty.

Any suggestions?

Statistics: Posted by sfsdfd — Wed Dec 11, 2024 1:56 pm



Viewing all articles
Browse latest Browse all 4829

Trending Articles