views:

97

answers:

3

Hello, everyone. How to track sections without sounds in a wav file? a small software what I want to develop is deviding a wav file, and it consider a no volume area as a deviding point. how can a program know that volume of a wav file is low? I'll use Java or MFC.

+1  A: 

Well, wave file is basicly a list of values, which represents a sound wave discreetly divided with some rate (44100 Hz usually). Silence is basicly when values are near 0. Just set some treshold value and look for continous ( let's say 100ms length) regions where value is below that treshold.

Luno
A: 

Simple silence detection is done by consequently comparing sound chunks with some value(which is choosed depending on record quality).

Something like:

abs(track[position]) < 0.1

or

(track[position]) < 0.1) && (track[position]) > -0.1)

if we assume that chunk is [-1, 1] float.

It would work better if sound is normalized.

stroncium
+2  A: 

I've had success with silence detection by calculating RMS of the signal. This is done in the following manner (assuming you have an array of audio samples):

    long sumOfSquares = 0;
    for (int i = startindex; i <= endindex; i++) {
        sumOfSquares = sumOfSquares + samples[i] * samples[i];
    }
    int numberOfSamples = endindex - startindex + 1;
    long rms = Math.sqrt(sumOfSquares / (numberOfSamples));

if rms is below a certain threshold, you can consider it being silent.

Buhb