public inbox for blinux-list@redhat.com
 help / color / mirror / Atom feed
* analyze a .wav or .mp3 file
@  Terry Klarich
   ` Hart Larry
   ` Chris Brannon
  0 siblings, 2 replies; 9+ messages in thread
From: Terry Klarich @  UTC (permalink / raw)
  To: Linux for blind general discussion

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.

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: analyze a .wav or .mp3 file
@  Martin McCormick
   ` Terry Klarich
  0 siblings, 1 reply; 9+ messages in thread
From: Martin McCormick @  UTC (permalink / raw)
  To: Linux for blind general discussion, Terry Klarich

Terry Klarich writes:
> 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.

My thanks to someone a couple of yers ago who suggested this
when I asked a similar question. It is slightly inaccurate as to
the time of mp3 files but it failry close.

#! /bin/sh
sox $1 -e   stat 


	I believe it will handle several formats of files.

Martin McCormick WB5AGZ  Stillwater, OK 
Systems Engineer
OSU Information Technology Department Telecommunications Services Group

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: analyze a .wav or .mp3 file
@  Martin McCormick
  0 siblings, 0 replies; 9+ messages in thread
From: Martin McCormick @  UTC (permalink / raw)
  To: Linux for blind general discussion

I just tried it and it will tell you if a .wav file is silent
but it didn't work on a mp3 so I was a bit mistaken. I think the
sox man page says it can handle mp3's if you have certain
libraries. It definitely worked on a 10-second sample of
stereophonic silence. Actually, it just has 0's for the
maximum, minimum and average levels so you might pipe that
through another decision to get a silence detector.

	Mplayer will convert mp3's to wav files.

Martin

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: analyze a .wav or .mp3 file
@  Martin McCormick
  0 siblings, 0 replies; 9+ messages in thread
From: Martin McCormick @  UTC (permalink / raw)
  To: Linux for blind general discussion, Chris Brannon

Thanks for the syntax reminder. I wrote that shell script before
the change. I also need to change another shell script that used
the stretch  command. sox reminds me every time that I need to
fix that. One of these days, a new version of sox will not work
at all.

Martin

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~ UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
 analyze a .wav or .mp3 file Terry Klarich
 ` Hart Larry
 ` Chris Brannon
   ` Tim Chase
     ` Geoff Shang
 Martin McCormick
 ` Terry Klarich
 Martin McCormick
 Martin McCormick

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).