将麦克风音频转换为MemoryStream [英] Convert Microphone Audio To MemoryStream
问题描述
我一直在努力弄清楚如何获取麦克风数据并将其转换为内存流,以便可以通过网络发送它.我一直在关注本教程
http://www.giawa.com/tutorials/?p=70 http://csharpwithmaddy.blogspot.ca/2008/01/sending-and- playing-microphone-audio.html
Hi, I''ve been trying to figure out how i can take the microphone data and convert it into a memorystream so I could send it over the network. I''ve been following this tutorial
http://www.giawa.com/tutorials/?p=70
with NAudio to get the microphone data I just don''t know how I can convert into a stream and then convert it back to something useful with NAudio afterwards. I am not very experience with NAudio nor have I really worked with audio in c# before. Any help would be greatly appreciated even if it uses another platform than NAudio. Thanks.
Also I have seen the following tutorial but had trouble trying to use it
http://csharpwithmaddy.blogspot.ca/2008/01/sending-and-playing-microphone-audio.html
推荐答案
请参阅类NAudio.Wave.WaveFileWriter
的定义.除其他外,它具有以下构造函数:
Please see the definition of the classNAudio.Wave.WaveFileWriter
. Among others, it has this constructor:
public WaveFileWriter(Stream outStream, WaveFormat format) { /*...*/ }
其中outStream
是要写入的流.因此,它可以是内存流(但是为什么呢?),或者根据您的目的,最好是网络流.
where outStream
is a stream to be written to. So, it can be a memory stream (but why?) or, according to your purpose, better be a network stream.
这篇关于将麦克风音频转换为MemoryStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!