Main Content

setExtractorParameters

Set nondefault parameter values for individual feature extractors

Since R2022a

Description

setExtractorParameters(aFE,featureName,params) specifies parameters used to extract featureName.

example

setExtractorParameters(aFE,featureName) returns the parameters used to extract featureName to default values.

example

Examples

collapse all

Read in an audio signal.

[audioIn,fs] = audioread("Counting-16-44p1-mono-15secs.wav");

Create an audioFeatureExtractor object to extract pitch. Set the method of pitch extraction to "LHS".

aFE = audioFeatureExtractor(SampleRate=fs,pitch=true);
setExtractorParameters(aFE,"pitch",Method="LHS")

Call extract and plot the results.

f0 = extract(aFE,audioIn);
plot(f0)

Figure contains an axes object. The axes object contains an object of type line.

Read in an audio signal.

[audioIn,fs] = audioread("Counting-16-44p1-mono-15secs.wav");

Create an audioFeatureExtractor object to extract the melSpectrum and spectralRolloffPoint. Specify ten bands for the mel spectrum and set the threshold for the rolloff point to 50% of the total energy.

aFE = audioFeatureExtractor(SampleRate=fs,melSpectrum=true,spectralRolloffPoint=true);
setExtractorParameters(aFE,"melSpectrum",NumBands=10)
setExtractorParameters(aFE,"spectralRolloffPoint",Threshold=0.5)

Call extract and plot the results.

features = extract(aFE,audioIn);
idx = info(aFE);

surf(10*log10(features(:,idx.melSpectrum)))
title("Mel Spectrum")

Figure contains an axes object. The axes object with title Mel Spectrum contains an object of type surface.

plot(features(:,idx.spectralRolloffPoint))
title("Spectral Rolloff Point")

Figure contains an axes object. The axes object with title Spectral Rolloff Point contains an object of type line.

To return individual audio feature extractors to their default values, call setExtractorParameters without specifying any parameters to set.

setExtractorParameters(aFE,"melSpectrum")
setExtractorParameters(aFE,"spectralRolloffPoint")

Call extract and plot the results.

features = extract(aFE,audioIn);
idx = info(aFE);

surf(10*log10(features(:,idx.melSpectrum)))
title("Mel Spectrum")

Figure contains an axes object. The axes object with title Mel Spectrum contains an object of type surface.

plot(features(:,idx.spectralRolloffPoint))
title("Spectral Rolloff Point")

Figure contains an axes object. The axes object with title Spectral Rolloff Point contains an object of type line.

Input Arguments

collapse all

Input object, specified as an audioFeatureExtractor object.

Name of feature extractor, specified as a character array or string.

Data Types: char | string

Parameters to set, specified as name-value arguments or a struct.

Version History

Introduced in R2022a

expand all

See Also

Objects