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:

  1. am thinking in right direction, or there simpler solution
  2. 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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -