pub struct MFCC { /* private fields */ }
Expand description
MFCC object
Mel-Frequency Cepstrum Coefficients object.
This object computes MFCC coefficients on an input CVec.
The implementation follows the specifications established by Malcolm Slaney in its Auditory Toolbox, available online at the following address (see file mfcc.m):
Implementations§
Source§impl MFCC
impl MFCC
Sourcepub fn new(
buf_size: usize,
n_filters: usize,
n_coeffs: usize,
sample_rate: u32,
) -> Result<Self>
pub fn new( buf_size: usize, n_filters: usize, n_coeffs: usize, sample_rate: u32, ) -> Result<Self>
Create MFCC object
buf_size
Size of analysis buffer (and length the FFT transform)n_filters
Number of desired filtersn_coeffs
Number of desired coefficientssamplerate
Audio sampling rate
Sourcepub fn with_power(self, power: Smpl) -> Self
pub fn with_power(self, power: Smpl) -> Self
Set power parameter
Sourcepub fn with_scale(self, scale: Smpl) -> Self
pub fn with_scale(self, scale: Smpl) -> Self
Set scaling parameter
Sourcepub fn with_mel_coeffs(self, fmin: Smpl, fmax: Smpl) -> Self
pub fn with_mel_coeffs(self, fmin: Smpl, fmax: Smpl) -> Self
Mel filterbank initialization
fmin
Start frequency, in Hzfmax
End frequency, in Hz
The filterbank will be initialized with bands linearly spaced in the mel scale, from fmin
to fmax
.
Sourcepub fn with_mel_coeffs_htk(self, fmin: Smpl, fmax: Smpl) -> Self
pub fn with_mel_coeffs_htk(self, fmin: Smpl, fmax: Smpl) -> Self
Mel filterbank initialization
fmin
Start frequency, in Hzfmax
End frequency, in Hz
The bank of filters will be initalized to to cover linearly spaced bands in the Htk mel scale, from fmin
to fmax
.
Sourcepub fn with_mel_coeffs_slaney(self) -> Self
pub fn with_mel_coeffs_slaney(self) -> Self
Mel filterbank initialization (Auditory Toolbox’s parameters)
The filter coefficients are built to match exactly Malcolm Slaney’s Auditory Toolbox implementation. The number of filters should be 40.
This is the default filterbank when mf was created with n_filters = 40
.
Sourcepub fn do_<'i, 'o, I, O>(&mut self, input: I, output: O) -> Status
pub fn do_<'i, 'o, I, O>(&mut self, input: I, output: O) -> Status
MFCC object processing
in
Input spectrum (buf_size
long)out
Output mel coefficients buffer (n_coeffs
long)
Sourcepub fn set_mel_coeffs(&mut self, fmin: Smpl, fmax: Smpl)
pub fn set_mel_coeffs(&mut self, fmin: Smpl, fmax: Smpl)
Mel filterbank initialization
fmin
Start frequency, in Hzfmax
End frequency, in Hz
The filterbank will be initialized with bands linearly spaced in the mel scale, from fmin
to fmax
.
Sourcepub fn set_mel_coeffs_htk(&mut self, fmin: Smpl, fmax: Smpl)
pub fn set_mel_coeffs_htk(&mut self, fmin: Smpl, fmax: Smpl)
Mel filterbank initialization
fmin
Start frequency, in Hzfmax
End frequency, in Hz
The bank of filters will be initalized to to cover linearly spaced bands in the Htk mel scale, from fmin
to fmax
.
Sourcepub fn set_mel_coeffs_slaney(&mut self)
pub fn set_mel_coeffs_slaney(&mut self)
Mel filterbank initialization (Auditory Toolbox’s parameters)
The filter coefficients are built to match exactly Malcolm Slaney’s Auditory Toolbox implementation. The number of filters should be 40.
This is the default filterbank when mf was created with n_filters = 40
.