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

**URL:** <https://discourse.nodered.org/t/streaming-audio-from-mic-to-node-red-flow-in-real-time/84055>\
**Category:** General\
**Created:** [27 December 2023 12:15 UTC](https://discourse.nodered.org/t/streaming-audio-from-mic-to-node-red-flow-in-real-time/84055 "2023-12-27T12:15:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jdo300](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jdo300/32/79415_2.png) [@Jdo300](https://discourse.nodered.org/u/Jdo300)\
**Post date:** [27 December 2023 12:15 UTC](https://discourse.nodered.org/t/streaming-audio-from-mic-to-node-red-flow-in-real-time/84055/1 "2023-12-27T12:15:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [27 December 2023 14:42 UTC](https://discourse.nodered.org/t/streaming-audio-from-mic-to-node-red-flow-in-real-time/84055/2 "2023-12-27T14:42:02Z")

</div>

> [@Jdo300](#):
>
> node-red-contrib-mic

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

```auto
./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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/42bf8416c7d515a2a7b6ecceb1bff3fc3afe72f6.gif)

---

<div class="post-metadata">

**Author:** ![Jdo300](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jdo300/32/79415_2.png) [@Jdo300](https://discourse.nodered.org/u/Jdo300)\
**Post date:** [8 January 2024 07:11 UTC](https://discourse.nodered.org/t/streaming-audio-from-mic-to-node-red-flow-in-real-time/84055/3 "2024-01-08T07:11:56Z")

</div>

Thank you, that solved my problem!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 January 2024 07:12 UTC](https://discourse.nodered.org/t/streaming-audio-from-mic-to-node-red-flow-in-real-time/84055/4 "2024-01-22T07:12:29Z")

</div>

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