CMSIS-DSP: MFCC

| CMSIS-DSP Version 1.10.0 CMSIS DSP Software Library

- Main Page
- Usage and Description
- Reference

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
MFCC
Transform Functions

## Functions

void | arm_mfcc_f16 (const arm_mfcc_instance_f16 *S, float16_t *pSrc, float16_t *pDst, float16_t *pTmp)
| MFCC F16. More...
void | arm_mfcc_f32 (const arm_mfcc_instance_f32 *S, float32_t *pSrc, float32_t *pDst, float32_t *pTmp)
| MFCC F32. More...
arm_status | arm_mfcc_init_f16 (arm_mfcc_instance_f16 *S, uint32_t fftLen, uint32_t nbMelFilters, uint32_t nbDctOutputs, const float16_t *dctCoefs, const uint32_t *filterPos, const uint32_t *filterLengths, const float16_t *filterCoefs, const float16_t *windowCoefs)
| Initialization of the MFCC F16 instance structure. More...
arm_status | arm_mfcc_init_f32 (arm_mfcc_instance_f32 *S, uint32_t fftLen, uint32_t nbMelFilters, uint32_t nbDctOutputs, const float32_t *dctCoefs, const uint32_t *filterPos, const uint32_t *filterLengths, const float32_t *filterCoefs, const float32_t *windowCoefs)
| Initialization of the MFCC F32 instance structure. More...
arm_status | arm_mfcc_init_q15 (arm_mfcc_instance_q15 *S, uint32_t fftLen, uint32_t nbMelFilters, uint32_t nbDctOutputs, const q15_t *dctCoefs, const uint32_t *filterPos, const uint32_t *filterLengths, const q15_t *filterCoefs, const q15_t *windowCoefs)
| Initialization of the MFCC F32 instance structure. More...
arm_status | arm_mfcc_init_q31 (arm_mfcc_instance_q31 *S, uint32_t fftLen, uint32_t nbMelFilters, uint32_t nbDctOutputs, const q31_t *dctCoefs, const uint32_t *filterPos, const uint32_t *filterLengths, const q31_t *filterCoefs, const q31_t *windowCoefs)
| Initialization of the MFCC F32 instance structure. More...
arm_status | arm_mfcc_q15 (const arm_mfcc_instance_q15 *S, q15_t *pSrc, q15_t *pDst, q31_t *pTmp)
| MFCC Q15. More...
arm_status | arm_mfcc_q31 (const arm_mfcc_instance_q31 *S, q31_t *pSrc, q31_t *pDst, q31_t *pTmp)
| MFCC Q31. More...

## Description

MFCC Transform

There are separate functions for floating-point, Q15, and Q31 data types.

MFCC Transform

There are separate functions for floating-point, Q15, and Q15 data types.

MFCC Transform

There are separate functions for floating-point, Q31, and Q31 data types.

## Function Documentation

void arm_mfcc_f16 | ( | const arm_mfcc_instance_f16 * | S,
|  | float16_t * | pSrc,
|  | float16_t * | pDst,
|  | float16_t * | pTmp
| ) |  |

Parameters

  [in] | S | points to the mfcc instance structure
  [in] | pSrc | points to the input samples
  [out] | pDst | points to the output MFCC values
  [in,out] | pTmp | points to a temporary buffer of complex

Returns
  none

Description
  The number of input samples if the FFT length used when initializing the instance data structure.

The temporary buffer has a 2*fft length size when MFCC is implemented with CFFT. It has length FFT Length + 2 when implemented with RFFT (default implementation).

The source buffer is modified by this function.

void arm_mfcc_f32 | ( | const arm_mfcc_instance_f32 * | S,
|  | float32_t * | pSrc,
|  | float32_t * | pDst,
|  | float32_t * | pTmp
| ) |  |

Parameters

  [in] | S | points to the mfcc instance structure
  [in] | pSrc | points to the input samples
  [out] | pDst | points to the output MFCC values
  [in,out] | pTmp | points to a temporary buffer of complex

Returns
  none

Description
  The number of input samples if the FFT length used when initializing the instance data structure.

The temporary buffer has a 2*fft length size when MFCC is implemented with CFFT. It has length FFT Length + 2 when implemented with RFFT (default implementation).

The source buffer is modified by this function.

arm_status arm_mfcc_init_f16 | ( | arm_mfcc_instance_f16 * | S,
|  | uint32_t | fftLen,
|  | uint32_t | nbMelFilters,
|  | uint32_t | nbDctOutputs,
|  | const float16_t * | dctCoefs,
|  | const uint32_t * | filterPos,
|  | const uint32_t * | filterLengths,
|  | const float16_t * | filterCoefs,
|  | const float16_t * | windowCoefs
| ) |  |

Parameters

  [out] | S | points to the mfcc instance structure
  [in] | fftLen | fft length
  [in] | nbMelFilters | number of Mel filters
  [in] | nbDctOutputs | number of Dct outputs
  [in] | dctCoefs | points to an array of DCT coefficients
  [in] | filterPos | points of the array of filter positions
  [in] | filterLengths | points to the array of filter lengths
  [in] | filterCoefs | points to the array of filter coefficients
  [in] | windowCoefs | points to the array of window coefficients

Returns
  error status

Description
  The matrix of Mel filter coefficients is sparse. Most of the coefficients are zero. To avoid multiplying the spectrogram by those zeros, the filter is applied only to a given position in the spectrogram and on a given number of FFT bins (the filter length). It is the reason for the arrays filterPos and filterLengths.

window coefficients can describe (for instance) a Hamming window. The array has the same size as the FFT length.

The folder Scripts is containing a Python script which can be used to generate the filter, dct and window arrays.

arm_status arm_mfcc_init_f32 | ( | arm_mfcc_instance_f32 * | S,
|  | uint32_t | fftLen,
|  | uint32_t | nbMelFilters,
|  | uint32_t | nbDctOutputs,
|  | const float32_t * | dctCoefs,
|  | const uint32_t * | filterPos,
|  | const uint32_t * | filterLengths,
|  | const float32_t * | filterCoefs,
|  | const float32_t * | windowCoefs
| ) |  |

Parameters

  [out] | S | points to the mfcc instance structure
  [in] | fftLen | fft length
  [in] | nbMelFilters | number of Mel filters
  [in] | nbDctOutputs | number of Dct outputs
  [in] | dctCoefs | points to an array of DCT coefficients
  [in] | filterPos | points of the array of filter positions
  [in] | filterLengths | points to the array of filter lengths
  [in] | filterCoefs | points to the array of filter coefficients
  [in] | windowCoefs | points to the array of window coefficients

Returns
  error status

Description
  The matrix of Mel filter coefficients is sparse. Most of the coefficients are zero. To avoid multiplying the spectrogram by those zeros, the filter is applied only to a given position in the spectrogram and on a given number of FFT bins (the filter length). It is the reason for the arrays filterPos and filterLengths.

window coefficients can describe (for instance) a Hamming window. The array has the same size as the FFT length.

The folder Scripts is containing a Python script which can be used to generate the filter, dct and window arrays.

arm_status arm_mfcc_init_q15 | ( | arm_mfcc_instance_q15 * | S,
|  | uint32_t | fftLen,
|  | uint32_t | nbMelFilters,
|  | uint32_t | nbDctOutputs,
|  | const q15_t * | dctCoefs,
|  | const uint32_t * | filterPos,
|  | const uint32_t * | filterLengths,
|  | const q15_t * | filterCoefs,
|  | const q15_t * | windowCoefs
| ) |  |

Parameters

  [out] | S | points to the mfcc instance structure
  [in] | fftLen | fft length
  [in] | nbMelFilters | number of Mel filters
  [in] | nbDctOutputs | number of Dct outputs
  [in] | dctCoefs | points to an array of DCT coefficients
  [in] | filterPos | points of the array of filter positions
  [in] | filterLengths | points to the array of filter lengths
  [in] | filterCoefs | points to the array of filter coefficients
  [in] | windowCoefs | points to the array of window coefficients

Returns
  error status

Description
  The matrix of Mel filter coefficients is sparse. Most of the coefficients are zero. To avoid multiplying the spectrogram by those zeros, the filter is applied only to a given position in the spectrogram and on a given number of FFT bins (the filter length). It is the reason for the arrays filterPos and filterLengths.

window coefficients can describe (for instance) a Hamming window. The array has the same size as the FFT length.

The folder Scripts is containing a Python script which can be used to generate the filter, dct and window arrays.

arm_status arm_mfcc_init_q31 | ( | arm_mfcc_instance_q31 * | S,
|  | uint32_t | fftLen,
|  | uint32_t | nbMelFilters,
|  | uint32_t | nbDctOutputs,
|  | const q31_t * | dctCoefs,
|  | const uint32_t * | filterPos,
|  | const uint32_t * | filterLengths,
|  | const q31_t * | filterCoefs,
|  | const q31_t * | windowCoefs
| ) |  |

Parameters

  [out] | S | points to the mfcc instance structure
  [in] | fftLen | fft length
  [in] | nbMelFilters | number of Mel filters
  [in] | nbDctOutputs | number of Dct outputs
  [in] | dctCoefs | points to an array of DCT coefficients
  [in] | filterPos | points of the array of filter positions
  [in] | filterLengths | points to the array of filter lengths
  [in] | filterCoefs | points to the array of filter coefficients
  [in] | windowCoefs | points to the array of window coefficients

Returns
  error status

Description
  The matrix of Mel filter coefficients is sparse. Most of the coefficients are zero. To avoid multiplying the spectrogram by those zeros, the filter is applied only to a given position in the spectrogram and on a given number of FFT bins (the filter length). It is the reason for the arrays filterPos and filterLengths.

window coefficients can describe (for instance) a Hamming window. The array has the same size as the FFT length.

The folder Scripts is containing a Python script which can be used to generate the filter, dct and window arrays.

arm_status arm_mfcc_q15 | ( | const arm_mfcc_instance_q15 * | S,
|  | q15_t * | pSrc,
|  | q15_t * | pDst,
|  | q31_t * | pTmp
| ) |  |

Parameters

  [in] | S | points to the mfcc instance structure
  [in] | pSrc | points to the input samples in Q15
  [out] | pDst | points to the output MFCC values in q8.7 format
  [in,out] | pTmp | points to a temporary buffer of complex

Returns
  none

Description
  The number of input samples is the FFT length used when initializing the instance data structure.

The temporary buffer has a 2*fft length.

The source buffer is modified by this function.

The function may saturate. If the FFT length is too big and the number of MEL filters too small then the fixed point computations may saturate.

arm_status arm_mfcc_q31 | ( | const arm_mfcc_instance_q31 * | S,
|  | q31_t * | pSrc,
|  | q31_t * | pDst,
|  | q31_t * | pTmp
| ) |  |

Parameters

  [in] | S | points to the mfcc instance structure
  [in] | pSrc | points to the input samples in Q31
  [out] | pDst | points to the output MFCC values in q8.23 format
  [in,out] | pTmp | points to a temporary buffer of complex

Returns
  none

Description
  The number of input samples is the FFT length used when initializing the instance data structure.

The temporary buffer has a 2*fft length.

The source buffer is modified by this function.

The function may saturate. If the FFT length is too big and the number of MEL filters too small then the fixed point computations may saturate.