Open JediMongoose opened 2 years ago
Try creating a mixer like this: Mixer(cardindex=1)
Hi. Thanks for the tip. I tried what you suggested, but get this:
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import alsaaudio
>>> mixer=alsaaudio.Mixer(cardindex=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
alsaaudio.ALSAAudioError: Unable to find mixer control Master,0 [hw:1]
I also tried:
>>> mixer=alsaaudio.Mixer("Mic Capture Volume",cardindex=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
alsaaudio.ALSAAudioError: Unable to find mixer control Mic Capture Volume,0 [hw:1]
>>> mixer=alsaaudio.Mixer("Mic",cardindex=1)
>>> volumes=mixer.getvolume()
>>> print volumes
[50]
which I thought was working! But, when I check with alsamixer, it's the 'wrong' Mic - I need the Capture one, not the Playback one.
Just to clarify, this command does show the volume from the 'correct' Mic:
$ amixer -c 1 cget iface=MIXER,name='Mic Capture Volume'
numid=8,iface=MIXER,name='Mic Capture Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=30,step=0
: values=19
| dBminmax-min=-12.00dB,max=33.00dB
I'm using pyalsaaudio on a Raspberry Pi with a USB audio device. I want to read and set the volume of the "Mic" input. With the amixer command, I can read the volume with:
amixer -c 1 cget iface=MIXER,name='Mic Capture Volume
And set it with:amixer -c 1 cset iface=MIXER,name='Mic Capture Volume' 50%
So I try replicating this behaviour with the mixertest.py script, but no amount of changing Mixer names etc will let me access the Mic volume.
I've tried:
But this just returns an empty array :(
Any help greatly appreciated