问题描述
我需要捕获从麦克风输入流在我的应用程序,这是写在VB.NET。我需要能够到c使用LAME MP3它这个数据传输到一个文件或通过HTTP和可能的EN $ C $。任何人可以帮助我开始使用呢?
I need to capture the input stream from a microphone in my application, which is written in VB.NET. I need to be able to stream this data to a file or over HTTP and possibly encode it using LAME MP3. Can anybody help me get started with this?
感谢您!
推荐答案
如果你想有一个.NET解决方案,你可以检查出 n音讯这是一个开放源码音频库。看 WaveInStream
类(或 WaveIn
最新code)。这将让你打开麦克风,并获得包含最新捕获的字节事件。这将是很容易的,然后传递到流。
If you want a .NET solution, you can check out NAudio which is an open source audio library. Look at the WaveInStream
class (or WaveIn
in the latest code). This will let you open a microphone, and receive events containing the latest captured bytes. This would be quite easy then to pass on to a stream.
至于使用LAME编码的MP3,一种方法我见过用的是传递声音通过标准输入到lame.exe和读取标准输出的MP3。这是我觉得比获得保留的LAME DLL和写作互操作的包装更容易。
As for encoding MP3 using LAME, one approach I have seen used is to pass the audio to lame.exe via stdin and read the mp3 from stdout. This is I think easier than getting hold of a LAME DLL and writing interop wrappers for it.
更新:我已经创建了一个使用n音讯从麦克风录制一个例子项目,瘸子保存为MP3格式的。见我在的Coding4Fun 文章这里。
Update: I have created an example project that uses NAudio to record from the microphone, and LAME to save as MP3 at http://voicerecorder.codeplex.com. See my article at Coding4Fun here.
这篇关于捕获麦克风音频流使用.NET Framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!