Extract audio data from usb sound card (rpi)

Hello, could you please give me suggestion how i can get audio from usb sound card into node-red. I use my phone as audio source and plug the audio jack into usb sound card connected to one of the raspberry's usb ports.
Is it possible to have for example frequency or bit rate in the debug node?

Thank you!

Everything is possible but...
Things like the bit rate and so on will largely not be determined by the original signal from the phone as you are sending analog audio over the cable but instead by how ever you set up the recording of the raw digital audio that is created by the usb sound card.
You could use any of the microphone nodes like node-red-contrib-mic, node-red-contrib-micropi, my own node-red-contrib-sox-utils or an exec node with an arecord or sox record command to get that digital data either as raw buffers or as wav file or similar into nodered. It will be in the format you set the mic/alsa too.
To actually do things like frequency analysis and spectrograms you will probably have to use desktop tools like audacity as i’m not aware of any nodes or commandline tools that could do that.
Which data do you want to extract exactly?
Johannes

Thank you for your replay!
I have a source that produce different tones (with different frequencies). My goal is to set up flow that can distinguish that and build some logic on this. Actually not need exactly the frequency, but i need way to recognize this different tones. Also this tones comes in realtime, not from file that is recorded.

Unfortunately node.js and therefore node-red is not the greatest tool for that. If your comfortable with python you could probably use something like pyAudioAnalysis and send the results to nodered over mqtt.
Otherwise you could go the machine learning approach which was begun to be discussed for a different use case in this thread.
There is some web audio stuff for javascript that could maybe do this but im not aware of any available nodered integration unfortunately.
All the solutions will involve you doing some coding and googling around github as im afraid there is no simple solution for this use case in nodered.

Thank you for your suggestions

1 Like

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