analyze a .wav or .mp3 file

Terry Klarich terry at klarich.net
Mon Jan 11 21:06:51 UTC 2010


Hello All:

I would like to see if anyone has an idea how to analyze a wav or mp3 file in a shell script to see if there is any audio present;
or, it is a blank file.

The story:
I have used a script for several years called xmonline to listen to xmradio over the internet.  Actually, I mostly used it to
record shows I wanted to listen to later.  Since, the original script used mplayer to play the stream, I modified the script to
write to a file on disk.  It worked well and I could listen to those shows on xm I had to miss for one reason or another.  (my own
xm audio recorder.

Recently, XM has changed their interface such that the xmonline script will no longer work.  I originally thought I cold use
firefox, and the analysis of the network trafic to write a new script.  Using curl as the xmonline script did, I am able to get
logged into the site.  But, when I dig out the stream and try and play it with mplayer, it doesn't work.  I know I'm missing some
simple little cookie or authorization parameter.  (Who knows)

Basically, I have given up on the streaming approach for now.  And, will use the brute force method.  I have my xmradio hooked up
via a sound card.  I am able to listen to xm on my computer with aplay just fine.  I even have a lirc config file that will turn
and off the unit and change channels.  Works great.

My problem is I have no way of knowing if the unit is on or off.  There is only a power toggle ir code.  If there was a power-on,
my problems would be over.

To get around this problem, I will first record a 10 second clip and see if there is anything there or not.  If there isn't, I know
the unit is off.

So, does anyone know a way to discover if there is any audio in a wav or mp3 file using a shell script running in the background?

Any suggestions wellcome.

THANKS!
Terry

P.S.
If anyone wants my failed xmrip script, they are welcome to see what they can do with it.




More information about the Blinux-list mailing list