麦克风实时音频播放。时间:2019-03-17 标签:c#
我希望创建一个应用程序,允许我从麦克风录音并通过其他电脑播放录音。然而,此时我只想让它在我自己的计算机上播放,这样我就可以让它工作了。
过去几个小时我一直在关注 NAudio,它似乎可以帮助我实现这个目标。
我只是想知道其他人是否有这方面的经验以及是否有可能?
谢谢, 斯图尔特
I am looking to create an application that will allow me to record from my mic and playback the recording through other pc's. At this point however I would just like it to play back on my own computer so I can get it working.
I have been looking at NAudio for the past few hours and it seems like it may be able to help me achieve this goal.
I am just wondering if anyone else has had any experience with this and if it is at all possible?
Thanks,
Stuart
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
codeproject 上有一个示例项目可以执行此操作:
http://www.codeproject.com/KB/cs/Streaming_wave_audio.aspx
我不知道延迟有多低。
作为编解码器,我推荐 Speex(至少对于语音)。它是免费、开源的,并提供低延迟和低带宽。
There is an example project on codeproject doing this:
http://www.codeproject.com/KB/cs/Streaming_wave_audio.aspx
I don't know how low the latency is.
As a codec I'd recommend Speex(at least for speech). It's free, open source and offers low latency and low bandwidth.
低音音频库是另一个值得研究的可靠选择。
Bass Audio Library is another solid option worth looking into.
这是可能的,但使用 WaveIn/WaveOut 不太可能获得低延迟(使用 WASAPI 可能会获得更好的结果)。您可以使用 BufferedWaveProvider (在最新的源代码中)来存储从麦克风录制音频并将输出提供给声卡。
It is possible to do, but you are unlikely to get low latency with WaveIn/WaveOut (possibly better results with WASAPI). You could use the BufferedWaveProvider (in the latest source code) to store up the audio being recorded from the microphone and supplying the output to soundcard.
NAudio 非常适合作为音频捕获和播放的起点,但正如 Mark 指出的那样,延迟可能是一个问题。
如果您采取下一步并希望通过网络发送音频数据,您将需要一个编解码器来压缩数据,因为 PCM 或 WAV 未压缩,而对于语音,您只需要 WAV 所需带宽的一小部分。
当您使用 C# 时,可以使用 Speex 的 C# 端口,名为 NSpeex,可能值得一看在..
NAudio is great as a starting point for audio capture and playback but as Mark pointed out the latency might be an issue.
If you take the next step and want to sent the audio data across the network you will need a codec to compress the data as PCM or WAV are uncompressed and for voice you only need a small part of the bandwidth needed for WAV.
As you are working with C# there is a C# port of Speex available, called NSpeex, which might be worth having a look at..