简体   繁体   English

有没有一种方法可以从MIC流音频并在Silverlight中播放该流

[英]Is there a way to stream audio from MIC and play that stream in Silverlight

So I want to stream the audio from a mic using NAudio and then pass that stream to WCF which a Siverlight app can consume to broadcast the live audio sound. 因此,我想使用NAudio将来自麦克风的音频流式传输,然后将其传递到WCF,Siverlight应用程序可以使用该流式传输现场音频。 I want the latency to be as low as possible. 我希望延迟尽可能短。

Any suggestions or if some one has already done it please point the source. 任何建议,或者如果有人已经做过,请指出来源。 Thanks in advance 提前致谢

To have low latency as possible, you should use the netTcpBinding and stream your audio in binary format. 为了尽可能降低延迟,您应该使用netTcpBinding并以二进制格式传输音频。 I would use MemoryStream for this and try to play with the buffersize to figure out what the best performance is. 我将为此使用MemoryStream并尝试使用buffersize来找出最佳性能。 Also, try checking audio formats for best performance. 另外,请尝试检查音频格式以获得最佳性能。 This also depends of the audio quality you expect. 这也取决于您期望的音频质量。

what you are asking is certainly possible, but will be a fair amount of work to do. 您的要求当然是可能的,但要做的工作还很多。 NAudio can handle to capturing microphone audio. NAudio可以处理捕获麦克风音频。

At the Silverlight end you can play custom audio formats (in this case PCM) using a custom media element streaming source. 在Silverlight端,您可以使用自定义媒体元素流源播放自定义音频格式(在本例中为PCM)。 See this one: http://code.msdn.microsoft.com/wavmss 看到一个: http : //code.msdn.microsoft.com/wavmss

I suspect latency would not be very good. 我怀疑延迟不是很好。 You can reduce it by keeping the buffer sizes small. 您可以通过减小缓冲区大小来减小它。 Also bear in mind that WAV is not a very efficient format to be sending over the network. 还请记住,WAV不是通过网络发送的非常有效的格式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM