使用 C# 检测 WAV 文件中的音频静音 [英] Detecting audio silence in WAV files using C#

查看:40
本文介绍了使用 C# 检测 WAV 文件中的音频静音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是构建一个 .NET 客户端应用程序来检测 WAV 文件中的静音.

这可以通过内置的 Windows API 实现吗?或者,有什么好的图书馆可以帮助解决这个问题?

解决方案

音频分析是一件困难的事情,需要大量复杂的数学运算(想想傅立叶变换).你必须问的问题是什么是沉默".如果您尝试编辑的音频是从模拟源捕获的,则很可能没有任何静音……它们只会是软噪声区域(线路嗡嗡声、环境背景噪声等).

综上所述,应该工作的算法是确定最小音量(幅度)阈值和持续时间(例如,<10dbA 超过 2 秒),然后简单地对波形进行音量分析以寻找区域符合此标准的(可能带有一些毫秒峰值过滤器).我从来没有用 C# 写过这个,但是这篇 CodeProject 文章看起来很有趣;它描述了绘制波形的 C# 代码......这与可用于进行其他幅度分析的代码相同.

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

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).

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.

这篇关于使用 C# 检测 WAV 文件中的音频静音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆