流录制的音频从浏览器到服务器 [英] Stream recorded audio from browser to server

查看:379
本文介绍了流录制的音频从浏览器到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想住流录制的音频从浏览器向服务器和播放。服务器将最终成为一个嵌入式设备可以播放这些音频流。

I would like to live stream recorded audio from the browser to the server and play it. The server will end up being a embedded device that plays these audio streams.

到目前为止,我已经成功地录制的音频和连接codeD它变成一个WAVE文件,并使用网络音频API播放上的浏览器,并按照此<一个href=\"http://typedarray.org/from-microphone-to-wav-with-getusermedia-and-web-audio/\">tutorial.

So far I've successfully recorded audio and encoded it into a WAVE file and play it on the browser using the web audio API and following this tutorial.

现在我有.WAV的EN codeD水滴流。我试图寻找方法以流这些与网络套接字连接后端的NodeJS并使用NPM模块播放它们。但我没有任何运气。

Now I have a stream of .WAV encoded blobs. I tried finding ways to stream these to a nodejs backend with a web socket connection and play them using a npm module. But I haven't had any luck.

有谁知道我应该遵循的任何资源或模块的?也许我应该尝试不同的做法?音频需要自记录在浏览器中相对快速地播放在服务器上

Does anyone know of any resources or modules I should follow? Maybe I should try a different approach? The audio needs to be played relatively quickly on the server since recording on the browser.

推荐答案

我在做这个目前正与一些软件,可以通过Web浏览器流媒体网络电台服务器。

I'm doing this currently with some software that allows for streaming to internet radio servers via your web browser.

我使用 WebAudio API ,提供的 getUserMedia 从声音装置获取实时PCM音频数据。从那里,我从32位浮点取决于可用带宽量转换此数据转换为16,12,或8位的数据。这种转换INT样品被写入到流设置与 BinaryJS 它包装上都的Node.js和客户流。正如BinaryJS奖励,你可以有很多流开,只要你想,所以我用第二个流过控制数据相同的WebSocket连接。

I use the WebAudio API along with getUserMedia to get live PCM audio data from the sound device. From there, I convert this data from 32-bit float to 16, 12, or 8 bit data depending on the amount of bandwidth available. This converted int samples are written to a stream setup with BinaryJS which wraps streams on both the Node.js and the client. As a bonus with BinaryJS, you can have as many streams open as you want, so I use a second stream over the same WebSocket connection for control data.

http://demo.audiopump.co:3000/

这篇关于流录制的音频从浏览器到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆