Changing speaker/microphone output/input volume from the command line in linux.

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
raptort3000
New User
Posts: 3
Joined: Mon Feb 04, 2019 6:35 pm

Changing speaker/microphone output/input volume from the command line in linux.

Postby raptort3000 » Mon Feb 04, 2019 7:14 pm

Hello Everyone,

Has anyone able to change the microphone and speaker volume from the command line or a C/C++ program in Linux using the XK-VF3100-C43 development board preferable with ALSA (amixer)?

OS: Ubuntu 16.04 x64
Advanced Linux Sound Architecture Driver Version k4.4.0-137-generic
amixer version 1.1.0

I have been able to get it working though the GUI, but I need to be able to control it within my program and I can not seem to figure out the correct ALSA commands to make it work.

Here is what the sound menu looks like in Ubuntu and I am able to control the volume up and down through the slider bar here just fine for both the speaker and microphone:
Screenshot from 2019-02-04 12-57-39.png
(64.05 KiB) Not downloaded yet
Screenshot from 2019-02-04 12-57-39.png
(64.05 KiB) Not downloaded yet


Here is what alsa displays as my sound cards and XMOS is in the list:
Screenshot from 2019-02-04 13-02-13.png
(54.64 KiB) Not downloaded yet
Screenshot from 2019-02-04 13-02-13.png
(54.64 KiB) Not downloaded yet


I am able to play audio out of the development kit just fine using this command:
aplay -D plughw:2,0 /usr/share/sounds/alsa/Front_Center.wav

Alsamixer does not seem to list any controls for the XMOS chip:
Screenshot from 2019-02-04 13-06-14.png
(23.82 KiB) Not downloaded yet
Screenshot from 2019-02-04 13-06-14.png
(23.82 KiB) Not downloaded yet


What I can't seem to do is recreate what they are doing in the GUI to adjust the volume on the command line. I want to be able to do something like "amixer set Master %50" but this command does not seem to have an effect on the speaker output.

Anyone been able to control volume from the command line or through there own software in Linux?

Thank you
raptort3000
New User
Posts: 3
Joined: Mon Feb 04, 2019 6:35 pm

Postby raptort3000 » Mon Feb 04, 2019 9:39 pm

Digging down into this issue a little more it looks like the GUI sound menu in Ubuntu is based on PulseAudio. PulseAudio builds on top of the ALSA kernel component but not the ALSA user-space component. My current theory is, PulseAudio is doing something to get the volume control to work that is not provided through the user space Alsa interface?
raptort3000
New User
Posts: 3
Joined: Mon Feb 04, 2019 6:35 pm

Postby raptort3000 » Tue Feb 05, 2019 3:54 pm

Hey Everyone,

For people who have this issue in the future, I believe I figured it out. ALSA has a software volume plugin that can be used when the volume control is not supported in hardware. Directions on how to set it up can be found here:

https://alsa.opensrc.org/Softvol

https://alsa.opensrc.org/How_to_use_sof ... ter_volume

Who is online

Users browsing this forum: No registered users and 27 guests