user836026
user836026

Reputation: 11350

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.

Upvotes: 2

Views: 3717

Answers (1)

Daniel Zhang
Daniel Zhang

Reputation: 5858

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.

Upvotes: 3

Related Questions