Main Content

setExtractorParams

Set nondefault parameter values for individual feature extractors

Description

example

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

example

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

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);
setExtractorParams(aFE,"pitch","Method","LHS")

Call extract and plot the results.

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

Figure contains an axes. The axes 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);
setExtractorParams(aFE,"melSpectrum","NumBands",10)
setExtractorParams(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. The axes with title Mel Spectrum contains an object of type surface.

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

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

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

setExtractorParams(aFE,"melSpectrum")
setExtractorParams(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. The axes with title Mel Spectrum contains an object of type surface.

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

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

Input Arguments

collapse all

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

Data Types: char | string

Parameters to set, specified as comma-separated name-value pairs or as a struct.

Introduced in R2019b