[asterisk-users] sound file length
asteriskusers at codetyrant.com
Thu Sep 21 18:01:37 MST 2006
If it is a wav file you can take the size of the file in bytes and
So if the file is 5 seconds long, and is 16 bit Linera PCM (uncompressed
ulaw), it contains 80,044 bytes.
Length = 80,044 - 44 = 80,0000
16,000 bytes / second is uncompressed ulaw, i.e. G.711
80000/ 5 = 16,000 bytes per second
so if you do this:
(size - 44 ) / 16 = time in seconds.
(80,044 - 44) / 16 = 5 seconds
So if you want the file to be more than 2 seconds to be good. Do this
2 * 16,000 + 44 = 32,044 bytes.
So if the file size is greater than 32,000 bytes you have a good file.
Any thing less then 32,000 bytes would fall under the 2 second
How you get the size of the file is up to you.
What language are you using? API?
Somewhere near Asheville, NC.
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Raphael
Sent: Tuesday, September 12, 2006 6:13 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [asterisk-users] sound file length
At some point in my dial plan, I need to find out the length of a sound
file in seconds (to weed out things that are way too short)
the record application doesn't seem to have any facilities to do that.
any ideas ?
--Bandwidth and Colocation provided by Easynews.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
More information about the asterisk-users