info
Output mapping and individual feature extractor parameters
Description
[
returns a second struct, idx,params] = info(___)params. The field names of
params correspond to the feature extractors with settable parameters.
If the "all" flag is specified, params contains all
feature extractors with settable parameters. If the "all" flag is not
specified, params contains only the enabled feature extractors with
settable parameters. You can set parameters using setExtractorParameters.
Examples
Extract the mel spectrum, mel spectral centroid, and mel spectral skewness from concatenated white and pink noise.
fs = 48e3; aFE = audioFeatureExtractor("SampleRate",fs, ... "melSpectrum",true, ... "SpectralDescriptorInput","melSpectrum", ... "spectralCentroid",true, ... "spectralSkewness",true); features = extract(aFE,[2*rand(fs,1)-1;pinknoise(fs,1)]);
Use info to determine which columns of the output correspond to which feature. Plot the features separately.
idx = info(aFE); surf(log10(features(:,idx.melSpectrum)),"EdgeColor","none"); view([90,-90]) axis tight title("Mel Spectrum") ylabel("Analysis Frame Number")

plot(features(:,idx.spectralCentroid)) axis tight title("Mel Spectral Centroid") xlabel("Analysis Frame Number")

plot(features(:,idx.spectralSkewness)) axis tight title("Mel Spectral Skewness") xlabel("Analysis Frame Number")

Create a default audioFeatureExtractor object. By default, all feature extractors are disabled.
aFE = audioFeatureExtractor
aFE =
audioFeatureExtractor with properties:
Properties
Window: [1024×1 double]
OverlapLength: 512
SampleRate: 44100
FFTLength: []
SpectralDescriptorInput: 'linearSpectrum'
FeatureVectorLength: 0
Enabled Features
none
Disabled Features
linearSpectrum, melSpectrum, barkSpectrum, erbSpectrum, mfcc, mfccDelta
mfccDeltaDelta, gtcc, gtccDelta, gtccDeltaDelta, spectralCentroid, spectralCrest
spectralDecrease, spectralEntropy, spectralFlatness, spectralFlux, spectralKurtosis, spectralRolloffPoint
spectralSkewness, spectralSlope, spectralSpread, pitch, harmonicRatio, zerocrossrate
shortTimeEnergy
To extract a feature, set the corresponding property to true.
For example, obj.mfcc = true, adds mfcc to the list of enabled features.
The info function returns information about enabled feature extractors. To view information about all feature extractors, call info using the "all" flag.
[idx,params] = info(aFE,"all")idx = struct with fields:
linearSpectrum: [1×0 double]
melSpectrum: [1×0 double]
barkSpectrum: [1×0 double]
erbSpectrum: [1×0 double]
mfcc: [1×0 double]
mfccDelta: [1×0 double]
mfccDeltaDelta: [1×0 double]
gtcc: [1×0 double]
gtccDelta: [1×0 double]
gtccDeltaDelta: [1×0 double]
spectralCentroid: [1×0 double]
spectralCrest: [1×0 double]
spectralDecrease: [1×0 double]
spectralEntropy: [1×0 double]
spectralFlatness: [1×0 double]
spectralFlux: [1×0 double]
spectralKurtosis: [1×0 double]
spectralRolloffPoint: [1×0 double]
spectralSkewness: [1×0 double]
spectralSlope: [1×0 double]
spectralSpread: [1×0 double]
pitch: [1×0 double]
harmonicRatio: [1×0 double]
zerocrossrate: [1×0 double]
shortTimeEnergy: [1×0 double]
params = struct with fields:
linearSpectrum: [1×1 struct]
melSpectrum: [1×1 struct]
barkSpectrum: [1×1 struct]
erbSpectrum: [1×1 struct]
mfcc: [1×1 struct]
gtcc: [1×1 struct]
spectralFlux: [1×1 struct]
spectralRolloffPoint: [1×1 struct]
pitch: [1×1 struct]
zerocrossrate: [1×1 struct]
Use the idx struct to enable all feature extractors on the audioFeatureExtractor object.
features = fieldnames(idx); for i = 1:numel(features) aFE.(features{i}) = true; end aFE
aFE =
audioFeatureExtractor with properties:
Properties
Window: [1024×1 double]
OverlapLength: 512
SampleRate: 44100
FFTLength: []
SpectralDescriptorInput: 'linearSpectrum'
FeatureVectorLength: 713
Enabled Features
linearSpectrum, melSpectrum, barkSpectrum, erbSpectrum, mfcc, mfccDelta
mfccDeltaDelta, gtcc, gtccDelta, gtccDeltaDelta, spectralCentroid, spectralCrest
spectralDecrease, spectralEntropy, spectralFlatness, spectralFlux, spectralKurtosis, spectralRolloffPoint
spectralSkewness, spectralSlope, spectralSpread, pitch, harmonicRatio, zerocrossrate
shortTimeEnergy
Disabled Features
none
To extract a feature, set the corresponding property to true.
For example, obj.mfcc = true, adds mfcc to the list of enabled features.
Create an audioFeatureExtractor to extract the ERB spectrum.
aFE = audioFeatureExtractor(erbSpectrum=true)
aFE =
audioFeatureExtractor with properties:
Properties
Window: [1024×1 double]
OverlapLength: 512
SampleRate: 44100
FFTLength: []
SpectralDescriptorInput: 'linearSpectrum'
FeatureVectorLength: 43
Enabled Features
erbSpectrum
Disabled Features
linearSpectrum, melSpectrum, barkSpectrum, mfcc, mfccDelta, mfccDeltaDelta
gtcc, gtccDelta, gtccDeltaDelta, spectralCentroid, spectralCrest, spectralDecrease
spectralEntropy, spectralFlatness, spectralFlux, spectralKurtosis, spectralRolloffPoint, spectralSkewness
spectralSlope, spectralSpread, pitch, harmonicRatio, zerocrossrate, shortTimeEnergy
To extract a feature, set the corresponding property to true.
For example, obj.mfcc = true, adds mfcc to the list of enabled features.
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 = struct with fields:
erbSpectrum: [1×1 struct]
params.erbSpectrum
ans = struct with fields:
NumBands: 43
FrequencyRange: [0 22050]
FilterBankNormalization: "bandwidth"
WindowNormalization: 1
SpectrumType: "power"
ApplyLog: 0
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
ans = struct with fields:
NumBands: 34
FrequencyRange: [0 8000]
FilterBankNormalization: "bandwidth"
WindowNormalization: 1
SpectrumType: "power"
ApplyLog: 0
You can modify the individual feature extractor parameters using setExtractorParameters. 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";
setExtractorParameters(aFE,erbSpectrum=params.erbSpectrum)
[~,params] = info(aFE);
params.erbSpectrumans = struct with fields:
NumBands: 40
FrequencyRange: [0 8000]
FilterBankNormalization: "bandwidth"
WindowNormalization: 1
SpectrumType: "magnitude"
ApplyLog: 0
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
ans = struct with fields:
NumBands: 40
FrequencyRange: [0 8000]
FilterBankNormalization: "bandwidth"
WindowNormalization: 1
SpectrumType: "magnitude"
ApplyLog: 0
To return parameters to their default values, call setExtractorParameters and specify no parameters.
setExtractorParameters(aFE,"erbSpectrum")
[~,params] = info(aFE);
params.erbSpectrumans = struct with fields:
NumBands: 43
FrequencyRange: [0 22050]
FilterBankNormalization: "bandwidth"
WindowNormalization: 1
SpectrumType: "power"
ApplyLog: 0
Input Arguments
Output Arguments
Mapping of requested features with output from extract, returned as a struct
with field names corresponding to individual feature extractors and field values
corresponding to column indices.
Settable parameters of individual feature extractors, returned as a struct with field names corresponding to individual feature extractors and field values containing parameter specification structs. The parameter specification structs have field names corresponding to settable parameter names and field values corresponding to the current parameter setting.
Version History
Introduced in R2019b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)