Visual Basic-声音检测 [英] Visual basic - Sound detection
问题描述
我正在尝试在Visual Basic .NET中制作一个程序,该程序将从我的PC上的麦克风输入中检测声音.该程序将接收一系列的蜂鸣声(声音/声音),这些声音将被转换为二进制数据以创建文件.
I am trying to make a program in Visual Basic .NET that is going to detect sound from the microphone input on my pc. The program is going to receive a series of beep sounds (sound/nosound) that is going to be translated in to binary data to create a file.
我尝试了多种代码来检测麦克风的声音,并尝试了多种代码来检测频率和活动.但是它们都不起作用.
I have tried multiple codes to detect sound from the microphone and tried multiple codes to detect frequency and activity. But none of them work.
那里有用于.NET的任何API/库.我可以尝试重制任何旧代码吗? 我的程序真的需要这个.
Is there any API/Library for .NET out there. Any old code which I can try to remake? Really need this for my program.
推荐答案
我无法解决频率部分,但是我确实有一些东西可以用来检测音量.这是一个C#项目,但我对其进行了编译并然后从我的VB.Net代码中引用它.基本上,我会等待声音尖峰,然后在出现尖峰时执行操作:
I can't help with the frequency part, but I do have something I use to detect volume coming in. It's a C# project, but I compile it and then reference it from my VB.Net code. Basically, I wait for a spike in sound and then perform an action when it occurs:
http://www.codeproject.com/Articles/20503/LED样式音量表使用DirectX
它需要DirectX,这是一个很大的安装,因此可能不希望使用(但是,它将帮助解决一半的问题).
It requires DirectX which is a large install so it may not be desirable (but, it will help with half of your problem).
您还可以查看CodePlex上的NAudio项目.它有很多不错的基于音频的代码.
You can also take a look at the NAudio project on CodePlex. It has a lot of audio based code that a decent following.
这篇关于Visual Basic-声音检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!