MATLAB Answers

Dropouts in audioPlayerRecorder audio streaming loop

10 views (last 30 days)
Stance
Stance on 30 Apr 2020
Edited: Kiran Felix Robert on 5 Feb 2021
Hi,
I have been trying to run an audioPlayerRecorder object smoothly, i.e., without any under/overruns. No matter what I have tried - different OS, tweaking buffer size etc - I am still getting initial dropouts. I tried adding zeros in the beginning of the signal but the underruns are still creating probelm when I extract the signal later in the script. I am not able to understand what exactly is going on. Please help.
  1 Comment
Mario Schwarz
Mario Schwarz on 5 Sep 2020
same issue here. Also with the recommended "setup" command it does not work.

Sign in to comment.

Answers (1)

Kiran Felix Robert
Kiran Felix Robert on 5 Feb 2021
Edited: Kiran Felix Robert on 5 Feb 2021
Hi Stance,
As a first step, you can run the Measure Audio Latency example to verify that your audio I/O system is configured correctly:
For profiling your code:
You can also go through the following link that has several steps to troubleshoot the issue of signal dropping and latency
As far as what we observe, under/overruns sometimes happen the first time we run, but usually we're good every other execution because all the underlying code is now cached in memory.
If none of the above links helps, then we need to inspect if the issue is due to hardware limitation of the device being used or the system being used.
This results when the processing loop in MATLAB is not able to supply samples at the rate the sound card demands due to system hardware limitation.
Although we cannot guarantee a processing speed to achieve the task, we would like to suggest you setting up some profiling of your algorithm or try reducing sample rate which might give better results.
There might be another possible issue that Some devices have a control panel to set the buffer length, it should match what is being used in the code. Hence if latency is not an issue , try increasing buffer length.

Community Treasure Hunt

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

Start Hunting!