[alsa-devel] [Alsa-user] Master volume control

Paul D. DeRocco pderocco at ix.netcom.com
Wed Mar 13 21:17:00 CET 2013

More on this.

My synth app, running on a dual-core Atom, has two sound generation threads,
running at a "nice" value of -20, and a normal control thread running at
nice 0. The control thread is what calls snd_ctl_elem_write when I move the
volume slider. My sound threads normally consume less than 50% of their
respective CPUs, but when I move the volume slider, I get underruns.

If I run "top -H" in a terminal window, I see three other processes that
suddenly consume gobs of CPU time as I change the volume.

	name            nice    CPU%
	pulseaudio      -11      19
	threaded-ml       0      14
	indicator-sound   0      11

If instead of using my synth's volume slider, I open alsamixer in another
terminal window, I don't see the same CPU usage, but I now attribute that to
the fact that the keyboard is issuing volume changes at a much slower rate
than my slider, which is read in a 200Hz loop. In fact, when I use
alsamixer, and ramp the volume up and down, every now and then I do get an
underrun. So it apparently won't matter whether I use snd_ctl_elem_write or

So what I'd like to know is why the hell does changing the volume every 5ms
suck up 44% of one CPU core? I get the feeling that the above processes
aren't integral to ALSA, and may go away when I move my app to a pure
embedded system, as opposed to Ubuntu. Is that the case? Am I chasing
phantoms? Since I'm not doing _anything_ related to sound on this machine,
other than developing my synth app (I don't even need a terminal beep), is
there any way I can uninstall the things that are hogging the CPU, like


Ciao,               Paul D. DeRocco
Paul                mailto:pderocco at ix.netcom.com 

More information about the Alsa-devel mailing list