%% Determine Settable Parameters of Individual Feature Extractors
% Create an audioFeatureExtractor to extract the ERB spectrum.

aFE = audioFeatureExtractor("erbSpectrum",true)

%
% The second output argument from info is a struct that contains the settable parameters of the individual feature extractors and their current value.

[~,params] = info(aFE)
params.erbSpectrum

%
% If you are using the default parameter values, then the parameters are dynamic and updated when properties they depend on are updated. For example, the default frequency range of the ERB filter bank and the default number of bandpass filters in the ERB filter bank depends on the sample rate. Decrease the sample rate of the audioFeatureExtractor object and then call info again.

aFE.SampleRate = 16e3;
[~,params] = info(aFE);
params.erbSpectrum

%
% You can modify the individual feature extractor parameters using setExtractorParams. Set the number of bands to 40 and the spectrum type to "magnitude". Call info to confirm that the parameters are updated.

params.erbSpectrum.NumBands = 40;
params.erbSpectrum.SpectrumType = "magnitude";
setExtractorParams(aFE,"erbSpectrum",params.erbSpectrum)
[~,params] = info(aFE);
params.erbSpectrum

%
% When you set individual feature extractor parameters, they remain at the set value until you set them to another value or return them to defaults. Return the sample rate of the audioFeatureExtractor object to its initial value and then call info. The parameters remain at their set value.

aFE.SampleRate = 44.1e3;

[~,params] = info(aFE);
params.erbSpectrum

%
% To return parameters to their default values, call setExtractorParams and specify no parameters.

setExtractorParams(aFE,"erbSpectrum")
[~,params] = info(aFE);
params.erbSpectrum

% Copyright 2019 The MathWorks, Inc.