简体   繁体   English

记录传入的音频流节点js

[英]Record incoming audio stream node js

I'm looking for a way to record an incoming audio stream from an external source ( http://audio12.broadcastify.com/krjb6ymsvnhf54z.mp3?nocache=8396379 ) into a node server. 我正在寻找一种将来自外部源( http://audio12.broadcastify.com/krjb6ymsvnhf54z.mp3?nocache=8396379 )的传入音频流录制到节点服务器的方法。 Ultimately I want to do some processing in real time on the stream and listen for specific frequencies within the audio. 最终,我想对流进行实时处理,并收听音频中的特定频率。

Is there anything out there to process incoming audio streams? 是否有任何东西可以处理传入的音频流?

There is a rewrite of the Web Audio API in JavaScript for Node.js: https://github.com/audiojs/web-audio-api 适用于Node.js的JavaScript中的Web Audio API进行了重写: https : //github.com/audiojs/web-audio-api

I think what would be easier in your case would be to use FFmpeg to fetch and decode the audio to PCM (via a simple child process, piping data to your app over STDIO), and then do your own processing from there. 我认为,在您的情况下,使用FFmpeg提取音频并将其解码为PCM(通过一个简单的子进程,通过STDIO将数据传输到您的应用程序),然后从那里进行自己的处理会更容易。

If you're looking for specific frequencies consider an implementation of the Goertzel Algorithm . 如果您正在寻找特定的频率,请考虑执行Goertzel算法 It's more efficient than doing a full FFT, if you only need a couple frequencies. 如果您只需要几个频率,它比执行完整FFT效率更高。

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

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