简体   繁体   中英

Detect silence in audio file

I wonder if there any example showing how to detect silence in audio file.

Would I would like to achieve is to record a audio with a format such as WAV, and check if there is real sound is recorded or just silence.

any clue is appreciated.

If you read the samples in from the WAV, you can sum their absolute value to get an idea of the total amplitude represented in the file. Lower values will indicate lower amplitude. You will likely have to calibrate this calculation to your specific problem.

In OS X or iOS, you can use Extended Audio File Services to obtain the samples. I have some example code posted at https://gist.github.com/d108/1ea9c833b10e714defef29824362821a to get you going.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM