Why is there a noticeable delay between the audio input and output on Beagleboard in Simulink 8.1 (R2013a)?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 22 May 2013
Edited: MathWorks Support Team
on 21 Dec 2018
I have a very simple model with an ALSA Audio Capture connected to an ALSA Audio Playback block from the Beagleboard library. When running the simulation on my Beagleboard, an mp3 audio file is used as the input, and there is a noticeable delay (~1 second) before I am able to hear the audio output.
Accepted Answer
MathWorks Support Team
on 21 Dec 2018
Edited: MathWorks Support Team
on 21 Dec 2018
This delay is intended.
The BeagleBoard audio blocks use ALSA framework for sound capture and playback. On both the capture and playback sides, there are ring buffers that hold audio samples. These ring buffers give a cushion while capturing/playing back audio against buffer overruns / underruns. In the BeagleBoard ALSA Audio Capture / Playback implementation, we try to set the ring buffer size to hold 0.5 seconds of data. The playback starts once this ring buffer is full so the minimum latency will be about 0.5 seconds of playback latency plus capture latency which varies with the frame size.
We arrived at the ring buffer size through a lot of experimentation. At lower frame sizes, buffer overruns / underruns become an issue and manifests itself as glitches in the audio. Reducing the latency to imperceptible levels requires better real-time response out of the kernel that Linux inherently is not capable of.
0 Comments
More Answers (0)
See Also
Categories
Find more on Audio Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!