Streaming audio from mic to Node-RED flow in real-time

Hello. I'm working on creating a flow in Node-RED that can read samples of voice input from a live audio input stream (a microphone), and create a visualization from the audio stream as the user is speaking. So far, I've been working with the node-red-contrib-mic node and created flows in both buffer and stream mode. But I'm running into an issue where the output samples are only send out every 500 ms in batches of 16000. I made some nodes to process the buffer for display but the 500 ms delay is messing up my visualization so I'm wondering if there is any way to get this node to send out the data in smaller chunks faster to reduce latency on my visualization?

If not, is there a better/different approach I can take to achieve this?

I can't see where you can control that.
But you maybe able to achieve realtime streaming with FFmpeg?

Example on OSX that produces MP3 inside an MPEGTS wrapper for my USB Camera MIC

0 is the index of my mic

./ffmpeg -f avfoundation -i ":0" -acodec libmp3lame -ab 196k -f mpegts udp://172.16.1.1:5868

its important to use UDP if going down this route, to stop the "play head" falling behind

This is me singing my favourite Spice Girls track
udp://172.16.1.1:5868 is the location of my UDP IN (Node RED)

Dec-27-2023 14-40-00

Thank you, that solved my problem!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.