MFCC Q31

riscv_status riscv_mfcc_init_q31(riscv_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)
MFCC_INIT_Q31 (32)
MFCC_INIT_Q31 (64)
MFCC_INIT_Q31 (128)
MFCC_INIT_Q31 (256)
MFCC_INIT_Q31 (512)
MFCC_INIT_Q31 (1024)
MFCC_INIT_Q31 (2048)
MFCC_INIT_Q31 (4096)
riscv_status riscv_mfcc_q31(const riscv_mfcc_instance_q31 *S, q31_t *pSrc, q31_t *pDst, q31_t *pTmp)
MFCC_INIT_Q31(LEN)
group MFCCQ31

Defines

MFCC_INIT_Q31(LEN)

Functions

riscv_status riscv_mfcc_init_q31(riscv_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)

Generic initialization of the MFCC Q31 instance structure.

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

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.

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

This function should be used only if you don’t know the FFT sizes that you’ll need at build time. The use of this function will prevent the linker from removing the FFT tables that are not needed and the library code size will be bigger than needed.

If you use NMSIS-DSP as a static library, and if you know the MFCC sizes that you need at build time, then it is better to use the initialization functions defined for each MFCC size.

Parameters
  • S[out] points to the mfcc instance structure

  • fftLen[in] fft length

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

MFCC_INIT_Q31 (32)

Initialization of the MFCC Q31 instance structure for 32 sample MFCC.

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

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.

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

Parameters
  • S[out] points to the mfcc instance structure

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

MFCC_INIT_Q31 (64)

Initialization of the MFCC Q31 instance structure for 64 sample MFCC.

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

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.

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

Parameters
  • S[out] points to the mfcc instance structure

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

MFCC_INIT_Q31 (128)

Initialization of the MFCC Q31 instance structure for 128 sample MFCC.

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

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.

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

Parameters
  • S[out] points to the mfcc instance structure

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

MFCC_INIT_Q31 (256)

Initialization of the MFCC Q31 instance structure for 256 sample MFCC.

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

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.

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

Parameters
  • S[out] points to the mfcc instance structure

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

MFCC_INIT_Q31 (512)

Initialization of the MFCC Q31 instance structure for 512 sample MFCC.

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

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.

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

Parameters
  • S[out] points to the mfcc instance structure

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

MFCC_INIT_Q31 (1024)

Initialization of the MFCC Q31 instance structure for 1024 sample MFCC.

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

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.

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

Parameters
  • S[out] points to the mfcc instance structure

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

MFCC_INIT_Q31 (2048)

Initialization of the MFCC Q31 instance structure for 2048 sample MFCC.

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

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.

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

Parameters
  • S[out] points to the mfcc instance structure

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

MFCC_INIT_Q31 (4096)

Initialization of the MFCC Q31 instance structure for 4096 sample MFCC.

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

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.

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

Parameters
  • S[out] points to the mfcc instance structure

  • nbMelFilters[in] number of Mel filters

  • nbDctOutputs[in] number of Dct outputs

  • dctCoefs[in] points to an array of DCT coefficients

  • filterPos[in] points of the array of filter positions

  • filterLengths[in] points to the array of filter lengths

  • filterCoefs[in] points to the array of filter coefficients

  • windowCoefs[in] points to the array of window coefficients

Returns

error status

riscv_status riscv_mfcc_q31(const riscv_mfcc_instance_q31 *S, q31_t *pSrc, q31_t *pDst, q31_t *pTmp)

MFCC Q31.

The temporary buffer has a 2*fft length.

Description

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

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.

Parameters
  • S[in] points to the mfcc instance structure

  • pSrc[in] points to the input samples in Q31

  • pDst[out] points to the output MFCC values in q8.23 format

  • pTmp[inout] points to a temporary buffer of complex

Returns

none