How To Track No Sound Area In A Wav File?

左心房为你撑大大i 提交于 2019-12-06 11:09:43

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.

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.

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!