This project has moved and is read-only. For the latest updates, please go here.

How to detect silence?

Nov 19, 2015 at 7:30 AM
Good day!
Can NAudio detect silence with some simple Api way?
Or, may be some peace of code.

Thank you!
Nov 21, 2015 at 10:51 PM
Easiest way is probably to check each sample processed for being 0 = silence.

E.g. create a custom SampleProvider that raises an event each time a sample passed is zero.
Dec 9, 2015 at 4:46 PM
I want to save the captured mic sound to different wave files by splitting the sound by silence
  1. Can I identify the silence immediately, once volume samples become 0 or do I need to check the 0 for some period of time (ex 2 sec silence time)?
  2. What is the best way to identify the silence, when there are background noise?
Thank you.
Dec 10, 2015 at 11:36 AM
1) Yes, you should check for at least some ms of audio. Because from time to time audio contains some zero crossings that would lead to false detection.
2) Either filter out the noise (e. g. cut a specified peak amaount) or calculate it in. As (white) noise contains all frequencies, you can´t easily filter out out by an eq or sth.
Dec 14, 2015 at 5:27 AM
Thank you for reply.
Is there any libraries for filter noise?
Dec 14, 2015 at 12:43 PM
I don´t know any .NET based.

But perhaps you can achive better results when you reduce overall volume by ~10-20% (which would discard some audio information as well). Anyway not possible without certain quality loss.