Play Sound from USB Microphone

Thanks guys,

I'll do some tests and come back to you as soon as I can.

Glenn

Would a USB webcam work instead? I have one or two of those lying around & I've meant to try them out, just not got round to it.

Yes a USB webcam will work.

1 Like

Hi Bart,

Struggling to load wav headers as shown. Please advise?

Glenn

Hi Bart,

All good now and loaded.

Great work! The sound plays through a USB Camera. I have yet to test with the separate microphone and I am yet to test latency.

My comment so far is that it sounds a little jagged at times as if bits of data are being missed. I have also had to reboot once as it stopped completely, but that maybe a separate issue I'm not sure. I will keep running trials and I will report back.

Thanks again

Glenn

Glenn,
You are welcome!

Would be nice if you could do some tests, because of I lots of other Node-red developments on my todo list.

That was something I was worried about. Will need to investigate it...

Do you think the wav-headers node is good enough to publish on NPM?

And another question. How have you implemented my change of the dashboard audio-out node?

I have made no implementation change. All I have done is load the wav node in, import your flow, stick two dashboard buttons on for playback and stop and deployed

Ah that might explain the missing samples. In the discussion you will see that I changed the dashboard code. Currently it will play one sample at a time. In my code the chunks with samples are continiously appending samples. I will do a pull request this evening, so Dave can load my changes. Hopefully it works smoother then for you.

Look forward to it. Thanks

Hi Dave (@dceejay),
I would like to pass my pimped dashboard version to Glenn, so he can test whether the audio is streamed smoothly with my fix. Once all tests are completed, I will create a pull request.
What is the easiest way to do this? Can I pass him the content of my /dist folder?

Thanks !
Bart

that should do it - though I'm happy to look at PR as soon as you are ready.

1 Like

Evening Dave (@dceejay),

Have been experimenting a bit further, with the aid of Glenn. The new node-red-contrib-wav-headers seems to be working fine, but there is still some work on the audio-out node. Glenn sended me same wave files (with his dashboard sound recordings) and the good new is that we have streaming audio. The bad news is that you can hear from time to time that the stream is chunked. Have been looking for solutions, but they are more complex as my original proposal (which was rather short).

So the question is: are you still interested in integrating it into the dashboard, if the code changes are becoming larger? Or should I create my own template node...

Still happy for a PR. As long as existing users won’t break when they upgrade.

Deal !

However it will take a bit longer as expected. But that is becoming a habit ...

1 Like

Hey Dave,

I'm completely stuck on the audio streaming. I managed to get acceptable quality in a dashboard running on my PC. However the sound has a lot of distortions on an Android phone. Have been remote debugging yesterday evening (via USB cable), but the code seems to be acting as I expected on my phone:

  • Enough audio chunks from the Node-RED flow are queued in the dashboard, so no gaps.
  • All parameters (number of channels, playback rate, ...) are identical to the test on my PC.
  • All audio chunks are nicely splitted and joined again.
  • ...

Since I have no indication anymore why the audio is bad on Android, I thought adding some troubleshooting functionality to the audio-out node. For example in this link it is explained how to visualise the audio samples in a graph, both a waveform (like oscilloscope) or frequency bars (like spectrum analyzer). Perhaps it doesn't help me finding the solution, but that is the only option I have at the moment :weary:

Do you think it would be a good idea to display - optionally - such a canvas in your audio-out node (invisible by default) or should I create a new custom node (based on the new widget API)? And if you prefer the first option, could you give me a hint how I should accomplish this (via ui.add...)?

I would prefer the first option, since I could add the AnalyzerNode in the existing audio chain that I have already build:
image
If you don't want this in the standard audio-out node, it might perhaps be better to put the entire streaming functionality in a custom node (and keep the audio-out node for playing a single audio file, as it does today already).

Thanks !
Bart

Hi Bart, apologies I got slightly confused with which method you are proposing as your preferred.... to extend the existing node ? or to create a new one ?
To my mind the audio out node is an end of a flow - If that suits this then yes... - but if what you are thinking is more like a debug node (as in you may want more than one...) then maybe a new node may be better - or at least turn off the actual audio out when in visual mode ?

Hi Dave, I prefer to add it to your node (but not visible by default). Reason: once we 'ever' publish it on npm, there will be users saying I doesn't work correctly on device X with browser Y. Then it could be useful that they could visualize the audio, e.g. dropdown on config screen ("not visible", "waveform", "spectrum"). It is just an idea, because I found the audio distortions very difficult to analyze. But as said before, I'm not an audio expert...

so the hide/show would be an option a config option in the node ?
I don't think I have a problem with that. (at this conceptual level :slight_smile:

1 Like