Sound / Silence in wav file

I'm looking for a utility / code that could detect and tell me if my 1 minute wav file contains sound or not? In another way, if it could detect the duration of silence (if exists) at any position in the wav file, would serve the server as well.

Does SOX support any command for this? I tried with Java but didn't find anything in JMF.

thanks

Vivec

+2


a source to share


3 answers


SoX has the ability to trim silence, but I'm not sure if this helps you:



silence [-l] over periods [duration threshold [d |%] [duration threshold below periods [d |%]]

Removes silence from the beginning, middle, or end of the sound. "Silence" is determined by a given threshold.

0


a source


You can write your wavefile processor easily, this is a simple header and then just plain data. You can easily find the sample size, 8 or 16 bits, and then read the sample file by sample if you find a sequence of samples with a value of 0, after which you have silence. Measure the number of samples to 0 and use the sample rate (also in the header) to calculate the duration.



0


a source


Audacity does this and is OpenSourced at sourceforge.net, so you should be able to compile all the required example code.

0


a source







All Articles