pCompiledNumChannels error in audio plugin generation

2 views (last 30 days)
Pablo Panitta
Pablo Panitta on 18 Oct 2020
Commented: Pablo Panitta on 20 Oct 2020
Hi
I´m trying to use crossoverFilter function as part of a more elaborated signal process plugin, but I find the following error message when I try to generate the audio plugin:
"Failed to compute constant value for nontunable property 'pCompiledNumChannels'. In code generation,nontunable properties can only be assigned constant values".
No issues at all when I run it through audioTestBench, but it does when I try to compile.
The code is really long, but as an example, I reproduce the same with a basic code attached. So, even when this one is not useful at all, I think help to reproduce the error easily.
classdef (StrictDefaults)CrossTest < matlab.System & audioPlugin
% CrossOver plugin test
properties
FCross=100;
end
properties (Constant, Hidden)
% Define the plugin interface
PluginInterface = audioPluginInterface( ...
'InputChannels',2,...
'OutputChannels',2,...
'PluginName','CrossOver Test',...
audioPluginParameter('FCross', ...
'DisplayName', 'Frequency Cutoff', ...
'Mapping', { 'int', 20, 18000}, ...
'Style', 'rotaryknob'))
end
properties (Access = private)
xFilt;
NumCrossovers = 1;
hpf;
pSR;
end
methods
% Constructor
function plugin = CrossTest
fs = getSampleRate(plugin);
plugin.xFilt=crossoverFilter("SampleRate",fs,"NumCrossovers",1,"CrossoverFrequencies",100,"CrossoverSlopes",6);
plugin.hpf=dsp.HighpassFilter('FilterType','IIR','PassbandFrequency',300,'StopbandFrequency',100,'StopbandAttenuation',40); % <<--- Agregado
end
function set.FCross (plugin,val)
plugin.FCross=val;
plugin.crossdesign;
end
end
methods(Access = protected)
%% OUT
function out = stepImpl(plugin, in)
infilt=plugin.hpf(in); % Filter the input signal
[O1,O2]=plugin.xFilt(infilt); % CrossOver the filtered Signal
out=O1+O2;
end
function resetImpl(plugin)
reset(plugin.xFilt);
end
end
methods (Access = private)
function crossdesign(plugin)
plugin.xFilt.CrossoverFrequencies=plugin.FCross;
end
end
end
I would really appreciate if someone give me a hint about how to overcome this.
Thanks
Pablo

Accepted Answer

jibrahim
jibrahim on 20 Oct 2020
Hi Pablo,
The corssover filter object is complaining that the number of channels is unknown. This is because the code generation compiler interprets the input to the crossover as having a varying 2nd dimension.
Modify the call to your crossover in stepImpl to this:
[O1,O2]=plugin.xFilt(infilt(:,1:2)); % CrossOver the filtered Signal
  3 Comments
Pablo Panitta
Pablo Panitta on 20 Oct 2020
Hi jibrahim
Outsanding explanation! Now I see why pre placing the hpf caused the issue. I didn´t know about the bahaviour of this object, but now is clear!
Thanks a lot!
br
Pablo

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by