linux - how to read out volume level of clients of pulseaudio in the console -
i read out volume of audio played @ moment several clients of pulseaudio.
the problem solve following: i'm listening music in xmms, put on pause, listen song friend sent me on youtube. after hour, discover not listening music!
the (very basic) solution thinking of bash scripts checks volume of apps other xmms every second, if application making sound, xmms paused, if there no sound, , xmms silent, xmms enabled. (i want able app-wise, instance, pidgin should ignored)
i find graphical tools read out volume, pavucontrol, displays nicely. not code kinds of c programs such simple thing, so:
- am thinking in right direction, or there simpler solution
- if there isn't, how readout current level of volume seperate apps
perhaps can record 1 sample of audio output stream , see if (close to) 0. pipeline gives single sample, in form of number between -32768 , 32767 (inclusive):
parec --raw --channels=1 --latency=2 2>/dev/null | od -n2 -td2 | head -n1 | cut -d' ' -f2- | tr -d ' '
you'll need adjust parec
arguments, , possibly pulseaudio configuration, tap output stream , record that.
Comments
Post a Comment