Raspberry pi 4 audio

Hello! I am having issues on using my microphone on my keyword spotting system project. First, I have deployed my project in a C++ SDK, however, I do not know how to get data in real time from the sensor (USB microphone). Then, I tried the CLI with a “.eim” file. But I don’t know how to keep the results in a specific variable. And finally, I would like to know if there is any way of activating this file with a shell, maybe. Can anybody help me? I would be flattered with any advice and possibility.

Hi @catmorais_07,

I do not know how to get data in real time from the sensor (USB microphone)

If you’re set on using C++, then you’ll likely need to use a driver like ALSA/soundlib to continuously read sound data from the microphone. See this thread for an example.

If you’re familiar with either JavaScript or Python, there are libraries for those languages that make reading from a USB mic much easier. You can use the .eim file with those languages, see here for working with Node.js and here for working with Python.