Continuous Audio Buffer in MATLAB?

1 次查看(过去 30 天)
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.

回答(1 个)

Gael Goron
Gael Goron 2018-5-15
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 .

类别

Help CenterFile Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by