Get auditory filter bank
The auditory filter bank contains a set of bandpass filters that are used to extract the cepstral features from an audio signal. The cepstral features include cepstral coefficients (
coeffs), the difference between the current and the previous cepstral coefficients (
delta), and the difference between the current and the previous delta values,
getFilters function returns the auditory filter bank and the corresponding frequency bins.
Read an audio signal from
'SpeechDFT-16-8-mono-5secs.wav' file. Extract a 40 ms segment from the audio data. Create a
cepstralFeatureExtractor System object™ that accepts a time-domain audio input signal sampled at 8 kHz.
[audioFile, fs] = audioread('SpeechDFT-16-8-mono-5secs.wav'); duration = round(0.04*fs); % 40 ms audioSegment = audioFile(5500:5500+duration-1); cepFeatures = cepstralFeatureExtractor('SampleRate',fs)
cepFeatures = cepstralFeatureExtractor with properties: Properties FilterBank: 'Mel' InputDomain: 'Time' NumCoeffs: 13 FFTLength:  LogEnergy: 'Append' SampleRate: 8000 Show all properties
Pass the 40 ms audio segment as an input to the
cepstralFeatureExtractor algorithm. The algorithm computes the mel frequency coefficients, log energy, delta, and delta-delta values of the audio segment.
[coeffs,delta,deltaDelta] = cepFeatures(audioSegment);
getFilters function, get the filter bank that computes the cepstral features. Each column in the filter bank contains a bandpass filter. The frequency bins corresponding to the bandpass filters are displayed in
Bins. Note that the
getFilters function requires the
cepstralFeatureExtractor object to be locked.
[filterbank, freq] = getFilters(cepFeatures);
Plot the filter bank, and you can see that the filter bank columns 33 to 40 have zero elements. These columns correspond to filters whose band edges (one or both) are above the Nyquist frequency, . In this example, the Nyquist frequency is 4 kHz.
ans = 1×8 103 × 3.6915 3.9543 4.2357 4.5371 4.8601 5.2059 5.5765 5.9733
ans = 0
Release the cepstral feature extractor object and pass a different audio signal sampled at 22.5 kHz.
release(cepFeatures) [audioFileTwo, fsTwo] = audioread('NoisySpeech-16-22p5-mono-5secs.wav'); duration = round(0.04*fsTwo); % 40 ms audioSegmentTwo = audioFileTwo(5500:5500+duration-1); cepFeatures = cepstralFeatureExtractor('SampleRate',fsTwo)
cepFeatures = cepstralFeatureExtractor with properties: Properties FilterBank: 'Mel' InputDomain: 'Time' NumCoeffs: 13 FFTLength:  LogEnergy: 'Append' SampleRate: 22500 Show all properties
The Nyquist frequency is 22,500/2, which is 11,250 Hz. Extract the cepstral features of the second audio segment. Plot the filter bank, which is used to compute the cepstral features. Zoom in on the axis for comparison.
[coeffsTwo,deltaTwo,deltaDeltaTwo] = cepFeatures(audioSegmentTwo); [filterbankTwo, freqTwo] = getFilters(cepFeatures); plot(freqTwo,filterbankTwo) axis([0 8000 0 0.015])
All the band edges are below the Nyquist frequency, and the bandpass filters in the filter bank have nonzero coefficients.
cepFeatures— Input cepstral feature extractor System object™
Input cepstral feature extractor, specified as a
object. To use the
getFilters function, the
object must be locked. The filter bank is defined only when the object is
locked. The object is locked when you call the object algorithm.
filterbank— Auditory filter bank
Filter bank used to calculate cepstral features, returned as a matrix.
Each column of the matrix corresponds to a single bandpass filter in the
filter bank. The number of columns in the matrix is given by
m – 2, where m is the length of
the vector you specify in the
BandEdges property of the
object. The number of rows in the matrix corresponds to the FFT
length. By default, the FFT length equals the number of rows in the input
signal. You can also specify the FFT length through the
FFTLength property of the System
If the Nyquist frequency, fs/2, is less than the band
edge frequencies you specify in the
the coefficients of the bandpass filters that fall outside the Nyquist range
are set to zero. fs is the sample rate you specify in the
SampleRate property of the System
freq— Frequency bins corresponding to filter bank (Hz)
Frequency bins corresponding to the filter bank in Hz, returned as a row vector. The length of the vector equals the FFT length.