how to remove the data (output of the function 'getaudiodata') from the memory buffer when I record an audio for long time and plot it at the same time?

7 views (last 30 days)
I record an audio signal from microphone and I plot it in real time. Simply I have:
rObj=audiorecorder(fs, 24, 2);
recordblocking(rObj)
y=getaudiodata(rObj);
data accumulates in samples so it can not do recording for long time. Is it possible to remove data from the memory sometimes?

Answers (1)

Walter Roberson
Walter Roberson on 13 Jun 2018
No, it is not.
If you do not need to keep all of the data until the end, and the amount of data is not easily handled, then you should not be using audiorecorder: you should be using the Audio System Toolbox, probably with audioDeviceReader()
  23 Comments
Walter Roberson
Walter Roberson on 21 Jul 2018
That BufferSize is too small, should be at least as large as SamplesPerFrame.
You should probably be telling animatedline to limit the number of points it displays.
hoda kazemzadeh
hoda kazemzadeh on 23 Jul 2018
I am trying to modify my code in GUI. I dont use audiotimer function now. In 'OutputFcn' I write the dsp.audiorecorder and step functions and display the signal. I get this error when it reaches the line of 'step' function :
A given audio device may only be opened once.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!