Control jack output volume

Device: Respeaker Mic Array v2

Raspberry Pi with Raspbian Stretch



I’m trying to figure out how I can change the output volume for the jack output on the Respeaker Mic Array.



Since the output channel uses S24_LE I don’t think I can use the normal alsamixer controls? Or is my .asoundrc wrong?

[code]
pcm.!default {
type plug
slave {
pcm “hw:1,0”
}
}

ctl.!default {
type hw
card 1
}
[/code]

Also, I tried to use the pixel_ring python code and use “pixel_ring.set_volume(10)” (and other numbers) to change the output volume. But maybe I misunderstand what that line does. Is it supposed to change the jack output volume? Because it doesn’t seem to do anything…

Hi there,



We can use alsa+softvol or pulseaudio to control the mic array v2.0 volume. thanks.



Bill

Hi Bill,



That is good to hear! However, in my case this doesn’t seem to work. Is my .asoundrc in my first post wrong? Or am I doing something else wrong?

Hi

After a couple of hours trying to figure out how alsa + softvol works from various sources, here is my working /etc/asound.conf file , in the hope it may help newbies in alsa/sound conf like me.



This card (usb ReSpeaker 4 Mic Array) doesn’t allow sound volume hardware configuration : you need to create a “softvol” “virtual” device that will allow you to modify the sound volume before sending it to the card PCM device. Check by launching “alsamixer”, F3 to change card/device -> warning message.

[code]
pcm.bcm2835 {
type hw
card ALSA
}
pcm.ArrayUAC10 {
type plug
slave.pcm “hw:1,0”
}

pcm.softvol {
type softvol
slave {
pcm “ArrayUAC10”
}
control {
name “Master”
card 0
}
}

pcm.!default {
type asym
playback.pcm “plug:softvol”
capture.pcm “ArrayUAC10”
}
[/code]

My configuration : Pi3 B+ with ReSpeaker 4 Mic Array v2 (UAC1.0) plugged via USB cable

This conf defaults to :

  • output via ReSpeaker Jack (to benefits from Noise Cancelation etc…)
  • Input (capture) from Array Mics



    No reboot needed but…

    Check with ‘alsamixer’ or ‘amixer’ : a new “Master” mixer sound control is now available :


amixer

Simple mixer control ‘Master’,0

Capabilities: volume

Playback channels: Front Left - Front Right

Capture channels: Front Left - Front Right

Limits: 0 - 255

Front Left: 237 [93%]

Front Right: 237 [93%]

Simple mixer control ‘PCM’,0

Capabilities: pvolume pvolume-joined pswitch pswitch-joined

Playback channels: Mono

Limits: Playback -10239 - 400

Mono: Playback 311 [99%] [3.11dB] [on]



Test with : aplay -f cd test.wav

adjust sound via command line : amixer sset ‘Master’ 70%



Source who helped :

<LINK_TEXT text=“https://alsa.opensrc.org/How_to_use_sof … ter_volume”>https://alsa.opensrc.org/How_to_use_softvol_to_control_the_master_volume</LINK_TEXT>



My usecase : https://snips.ai/ (alexa/GHome (real/serious/capable) alternative voice assistant not using any Cloud, speech recognition is 100% made on the Pi : PRIVACY by design)

This Github issue addresses the question of having simpler volume control for the headphone jack.