检测音频沉默WAV文件使用C#沉默、音频、文件、WAV

2023-09-02 10:49:16 作者:感谢经历@

我负责建立一个.NET客户端应用程序来检测一个WAV文件沉默。

I'm tasked with building a .NET client app to detect silence in a WAV files.

这可能与内置的Windows API?或者交替进行,任何好的库都来帮助呢?

Is this possible with the built-in Windows APIs? Or alternately, any good libraries out there to help with this?

推荐答案

音频分析是一件困难的事情,需要很多复杂的数学(认为傅立叶变换)。你要问的问题是什么是沉默。如果你想编辑的音频是从模拟源捕捉的机会是没有任何的沉默...他们只会软噪声(线嗡嗡声,环境背景噪声等)的领域。

Audio analysis is a difficult thing requiring a lot of complex math (think Fourier Transforms). The question you have to ask is "what is silence". If the audio that you are trying to edit is captured from an analog source, the chances are that there isn't any silence... they will only be areas of soft noise (line hum, ambient background noise, etc).

所有这一切说,应该工作的算法是要确定一个最小体积(振幅)阈值和持续时间(例如,&所述; 10dbA超过2秒),然后根本波形的体积分析寻找区域符合此条件的(有可能是一些过滤器为毫秒峰值)。我从来没有写在C#,但这 $ C $的CProject文章,看起来很有趣;它描述了C#code绘制波形...这是同一种code可以用来做其他的振幅分析。

All that said, an algorithm that should work would be to determine a minimum volume (amplitude) threshold and duration (say, <10dbA for more than 2 seconds) and then simply do a volume analysis of the waveform looking for areas that meet this criteria (with perhaps some filters for millisecond spikes). I've never written this in C#, but this CodeProject article looks interesting; it describes C# code to draw a waveform... that is the same kind of code which could be used to do other amplitude analysis.