How can I reduce latency while processing audio in Simulink?

4 次查看(过去 30 天)
I'm trying to process audio signals using DSP toolbox in Simulink. I'm using the "from wave device" block to input microphone or guitar signals.
While my circuit is able to process the signal, there's a lot of latency(about one second or more). I need to know how to reduce this latency.
I don't think hardware is an issue. I'm using an external audio interface and have tested it with other signal processing software and there has been almost no latency(~10ms and is unnoticeable).
For my purposes, it is very essential that the latency is lower than 20ms.
Would be great if I knew how to reduce the latency. Thanks.
  4 个评论
Tucker McClure
Tucker McClure 2012-11-20
编辑:Tucker McClure 2012-12-27
[Moved comment to answer section per Walter's recommendation.]
Walter Roberson
Walter Roberson 2012-11-20
Thanks, Tucker! I would suggest you move your comment to become an Answer.

请先登录,再进行评论。

回答(1 个)

Tucker McClure
Tucker McClure 2012-12-27
Hi Debraj,
Yes, Walter is right. ASIO support first shipped with r2012a, and without ASIO, you probably won't reduce your latency below 20ms inside of MATLAB/Simulink.
Options:
  • Update to 12a. This is by far the easiest, will have very good latency performance, and is a great way to prototype algorithms. I have even fairly complicated algorithms running with ~5ms latency in MATLAB.
  • Generate C code from your Simulink model via Simulink Coder and Embedded Coder. Wrap the C code into a VST plugin or some such thing. This is expensive, but is a mature solution to developing production-ready C code from Simulink and has the added benefit of being completely portable. If you're a pro, this is a very good option for much more than just latency reduction.
  • The final option is something I've seen but is a really bad option. You could compile PortAudio yourself to get ASIO into an older version of MATLAB. This requires a lot of work, downloading libraries from third parties, figuring out how to build them, and actually changing your MATLAB binaries. Not recommended.
I can't help with Audio Plugin Generator. Never used it.
- Tucker

Community Treasure Hunt

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

Start Hunting!

Translated by