Struct MFCC

Source
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):

https://engineering.purdue.edu/~malcolm/interval/1998-010/

Implementations§

Source§

impl MFCC

Source

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 filters
  • n_coeffs Number of desired coefficients
  • samplerate Audio sampling rate
Source

pub fn with_power(self, power: Smpl) -> Self

Set power parameter

Source

pub fn with_scale(self, scale: Smpl) -> Self

Set scaling parameter

Source

pub fn with_mel_coeffs(self, fmin: Smpl, fmax: Smpl) -> Self

Mel filterbank initialization

  • fmin Start frequency, in Hz
  • fmax End frequency, in Hz

The filterbank will be initialized with bands linearly spaced in the mel scale, from fmin to fmax.

Source

pub fn with_mel_coeffs_htk(self, fmin: Smpl, fmax: Smpl) -> Self

Mel filterbank initialization

  • fmin Start frequency, in Hz
  • fmax 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.

Source

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.

Source

pub fn do_<'i, 'o, I, O>(&mut self, input: I, output: O) -> Status
where I: Into<CVec<'i>>, O: Into<FVecMut<'o>>,

MFCC object processing

  • in Input spectrum (buf_size long)
  • out Output mel coefficients buffer (n_coeffs long)
Source

pub fn set_power(&mut self, power: Smpl)

Set power parameter

Source

pub fn get_power(&self) -> Smpl

Get power parameter

Source

pub fn set_scale(&mut self, scale: Smpl)

Set scaling parameter

Source

pub fn get_scale(&self) -> Smpl

Get scaling parameter

Source

pub fn set_mel_coeffs(&mut self, fmin: Smpl, fmax: Smpl)

Mel filterbank initialization

  • fmin Start frequency, in Hz
  • fmax End frequency, in Hz

The filterbank will be initialized with bands linearly spaced in the mel scale, from fmin to fmax.

Source

pub fn set_mel_coeffs_htk(&mut self, fmin: Smpl, fmax: Smpl)

Mel filterbank initialization

  • fmin Start frequency, in Hz
  • fmax 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.

Source

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.

Trait Implementations§

Source§

impl Drop for MFCC

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for MFCC

§

impl RefUnwindSafe for MFCC

§

impl !Send for MFCC

§

impl !Sync for MFCC

§

impl Unpin for MFCC

§

impl UnwindSafe for MFCC

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.