NAudio网络流媒体
我有一个使用 NAudio 播放一些 mp3 文件的应用程序,我花了几天时间尝试通过网络将这个声音发送到另一台电脑,但我不知道什么是更好的方法。 我需要使用哪些类来访问缓冲区以及如何重新构建要在远程播放的字节数组?什么是最好的,发送 mp3Frames,或者发送原始或 pcm 数据可能更好?
我真的迷路了,任何帮助将不胜感激。 谢谢
I have an app that plays some mp3 files with NAudio and I spent a few days trying to send this sound over network to another pc, but I'm lost about what's the better way to do that.
What classes I need to use to access the buffer and how to re-build that byte array to be played in remote? What is best, send mp3Frames, or it could be better to send raw or pcm data?
I'm really lost, any help would be appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议通过网络传输 MP3,而不是 PCM,因为 PCM 文件比 MP3 大很多。
最新的 NAudio 源代码 包含播放互联网 MP3 广播的演示(在 NAudioDemo 项目中)它将向您展示如何接收 MP3 帧、解压缩它们并将它们放入 BufferedWaveProvider 中进行播放。我写了 关于它如何在我的博客上工作的文章。
NAudioDemo 还包括网络点对点音频聊天的演示,使用 UDP 套接字发送音频,但不使用 MP3 进行压缩。
I would recommend transmitting across the network as MP3, not PCM as the PCM files are a lot larger than the MP3.
The latest NAudio source code includes a demo (in the NAudioDemo project) of playing internet MP3 radio which will show you how to receive MP3 frames, decompress them, and put them into a BufferedWaveProvider for playback. I've written an article about how this works on my blog.
NAudioDemo also includes a demo of network peer to peer audio chat, sending the audio using UDP sockets, although MP3 isn't used for the compression.