Continuous Audio Buffer in MATLAB?

8 views (last 30 days)
Leon Müller
Leon Müller on 6 May 2018
Answered: Gael Goron on 15 May 2018
Hello MATLAB-Community,
I'm somewhat new to MATLAB and its environment. For a bigger project I need to be able to construct a continuous Audio-Buffer of a certain size, that will automatically "overwrite" itself once it has run full. The Buffer should receive input from a microphone and record the entire time while the program is running. Afterwards I want to be able to do some computing with the output from the Buffer. Is there some convenient way of doing this? I found that the audioDeviceReader- and the dsp.AudioPlayer-objects should be useable for this operation, but I haven't figured out how.
Any help is appreciated.

Answers (1)

Gael Goron
Gael Goron on 15 May 2018
Hello,
You are on the right track, yes you can use the audioDeviceReader System object. If you look on the online documentation, you will also see some example code to acquire buffered audio from a microphone: audio device reader
Note that after the line of code:
acquiredAudio = deviceReader();
Instead of writing the data to a file, you can also do some computing. Note that the 'SamplesPerFrame' property of the audioDeviceReader object is your audio buffer size.
Another example that shows how to use this function to compute the frequency response is available here .

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!