我需要从我的应用程序中的麦克风捕获输入流,该应用程序是用 VB.NET 编写的.我需要能够将此数据流式传输到文件或通过 HTTP 并可能使用 LAME MP3 对其进行编码.有人可以帮我开始吗?
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 解决方案,你可以查看 NAudio 这是一个开源音频库.查看WaveInStream
类(或最新代码中的WaveIn
).这将让您打开麦克风,并接收包含最新捕获字节的事件.这将很容易传递给流.
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,我见过的一种方法是通过 stdin 将音频传递给 lame.exe,然后从 stdout 读取 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.
更新:我创建了一个示例项目,该项目使用 NAudio 从麦克风录音,并在 http://voicerecorder.codeplex.com.请参阅我在 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 捕获麦克风音频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!