Delay line for code generation

조회 수: 5 (최근 30일)
Mattias Arlbrant
Mattias Arlbrant 2024년 12월 13일
댓글: Mattias Arlbrant 2024년 12월 31일
Hi,
I am doing audio processing algorithms in matlab code that should support code generation. What is a good choice for a simple delay? The delay does not need to change during processing, it should be efficient, have a fixed upper bound and the actual delay set during initialization from a parameter (before playback starts).
I would like to avoid reinventing the wheel or at least reinventing delay lines. Is dsp.VariableIntegerDelay a good choice for this purpose?
dsp.VariableIntegerDelay seems to work for processing in matlab but I have not tried codegen yet.
When I check the size of my dsp.VariableIntegerDelay as a member of my processor object using whos, I get 8 bytes. Seems weird since I instantiated it using dsp.VariableIntegerDelay('MaximumDelay',256);
Thanks
  댓글 수: 1
Walter Roberson
Walter Roberson 2024년 12월 16일
When I check the size of my dsp.VariableIntegerDelay as a member of my processor object using whos, I get 8 bytes.
Likely you are checking the size of a handle object. whos reflects the size of the handle pointer, 8 bytes, not the size of the underlying object.

댓글을 달려면 로그인하십시오.

답변 (1개)

jibrahim
jibrahim 2024년 12월 13일
There are multiple objects you can use to model delays:
They all support code generation.
You can't use 'whos' to check how much memory the object is consuming, as 'whos' just returns the size of the handle variable pointing to the object.
  댓글 수: 13
Walter Roberson
Walter Roberson 2024년 12월 30일
I definitely want to avoid using global variables and instead make the delaylines members of structs or classes.
If you were to create struct or class variables representing the integer delay, and were to somehow import them into the function, then you would run across the problem that simulink signals cannot be System objects and so you cannot store system objects in simulink variables. As a result, the best you could do would be to import a variable that is an integer or double, and create the dsp.VariableIntegerDelay every time though the function.
Mattias Arlbrant
Mattias Arlbrant 2024년 12월 31일
I am not sure how Simulink variables and signals relate to what I am doing since I am using Matlab.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by