0

I'm trying to write a script that automatically changes the playback/capture audio levels based on the device that is connected.

I'm using a MAYA44 USB+ sound with 4 ch in/out.

Thanks to a similar question here: https://askubuntu.com/questions/97936/terminal-command-to-set-audio-volume

I learned to use the following command:

amixer -c 2 sset Line,1 50%

The problem I have is that it seems like the capture control shares the same name as a playback control: Line

enter image description here

Doing

amixer -c 2 sset Line 50%

Changes the values of BOTH controls.

As mentioned above, I'm writing a script to do this automatically so I don't want to manually go into alsamixer and do it manually.

Is there a way to rename the controls so that there isn't a naming clash? Otherwise, is there some sore of suffix or prefix I can add to the 'Line' value to specify that I want to affect the CAPTURE device? Would using pulse audio in some way be another option?

Basically, how I can change the capture control values without affecting the playback values?

Thanks in advance!

2

Use amixer -c2 controls to list all the low-level controls.

Then you can use amixer -c2 cset .. to select specific controls by their unique ID number.

| improve this answer | |
  • I tried this earlier and it failed... Having tinkered with it a bit more, I realized that in the line 'numid=10, iface=MIXER, name='Line Capture Switch'' the unique id is in fact 'numid=10' instead of being 10! This worked like a charm, I thank you CL. – Adam Jun 30 '16 at 21:48
  • Do you know if these unique IDs are consistent? Could I hardcode them into my script? – Adam Jun 30 '16 at 21:51
  • They might change with a different driver/kernel version. – CL. Jul 1 '16 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.