How can I handle processing live audio data?

I am using the "audiorecorder" object and the "record" function to process live audio data using techniques like FFT, binning, and filtering. I am using a timer callback to process the data every so often. However, the time it takes to process a chunk of data is longer than the time it took to record that data, which means that over time the amount of data I need to process when I call "getaudiodata" or use a callback also increases. It gets to the point where the time it takes to process the data is longer than it takes for the next callback to trigger. Trying to use "recordblocking" or a time parameter does not help in fixing the issue either.

 Accepted Answer

The objects "audiorecorder" and "getaudiodata" are optimized for batch processing of audio. For real-time audio processing, the recommended workflow is to use the real-time audio I/O objects "audioDeviceReader" and "audioDeviceWriter" in the Audio Toolbox. For more information, you can access the release-specific documentation by executing the following command in the MATLAB R2019b command window:
>> web(fullfile(docroot, 'audio/gs/real-time-audio-in-matlab.html'))
The Sound Pressure Measurement Example App illustrates the use of these objects. To explore this example, execute the following command in the MATLAB R2019b command window:
>> web(fullfile(docroot, 'audio/examples/sound-pressure-measurement-of-octave-frequency-bands.html'))
Please follow the link below to search for the required information regarding the current release:

More Answers (0)

Products

Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!