matlab how to generate pitch.m C/C++ code with coder

one of module call pitch.m as follow
f0 = pitch(sig1, fs, 'WindowLength', round(fs .* 0.05), 'OverlapLength', round(fs * (0.05 - 0.025)));
but coder failed to generate C/C++ code. error message as follow:
Failed to compute constant value for nontunable property 'WindowLength'. In code generation, nontunable properties can only be assigned constant values.

 Réponse acceptée

Walter Roberson
Walter Roberson le 18 Août 2021

1 vote

You will need to have a switch statement on every fs that you wish to permit, each time calling with a hard-coded WindowLength. So for example you might have a branch for 8000, another for 11025, another for 12000, another for 22050, another for 24000, another for 44100, another for 48000, and so on.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange

Produits

Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by