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.

 採用された回答

Walter Roberson
Walter Roberson 2021 年 8 月 18 日

1 投票

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.

1 件のコメント

大大 习
大大 习 2021 年 8 月 18 日
It works. That's pretty odd. But it works.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

製品

リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by