How To Track No Sound Area In A Wav File?

梦想的初衷 提交于 2019-12-10 10:45:02

问题


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:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/1808146/how-to-track-no-sound-area-in-a-wav-file

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