Skip to content

File syn_mfcc.h

FileList > dsp > syn_mfcc.h

Go to the source code of this file

Zero-Heap Fixed-Point Mel-Frequency Cepstral Coefficients (MFCC) Extractor. More...

  • #include "syntropic/common/syn_defs.h"
  • #include "syntropic/dsp/syn_dsp.h"
  • #include "syntropic/dsp/syn_fft.h"
  • #include "syntropic/util/syn_qmath.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_MFCC

Public Functions

Type Name
SYN_Status syn_mfcc_init (SYN_MFCC * mfcc, uint16_t sample_rate_hz, uint16_t fft_size)
Initialize MFCC Extractor Context.
SYN_Status syn_mfcc_process_frame (SYN_MFCC * mfcc, const int16_t * pcm_in, q7_t mfcc_out)
Process one window of 16-bit PCM audio samples and compute 13 Q7 MFCC coefficients.

Macros

Type Name
define SYN_MFCC_MAX_FFT_SIZE 128U
define SYN_MFCC_NUM_COEFFS 13U
define SYN_MFCC_NUM_MEL_FILTERS 26U

Detailed Description

Extracts 13 Mel-Frequency Cepstral Coefficients (MFCC) from raw 16-bit PCM audio using fixed-point Q15 arithmetic for microcontrollers running keyword spotting (KWS) and acoustic anomaly detection with syn_nn.

Public Functions Documentation

function syn_mfcc_init

Initialize MFCC Extractor Context.

SYN_Status syn_mfcc_init (
    SYN_MFCC * mfcc,
    uint16_t sample_rate_hz,
    uint16_t fft_size
) 

Parameters:

  • mfcc Pointer to MFCC context.
  • sample_rate_hz Audio sample rate in Hz.
  • fft_size FFT window size (must be 64 or 128).

Returns:

SYN_OK on success, SYN_INVALID_PARAM if invalid.


function syn_mfcc_process_frame

Process one window of 16-bit PCM audio samples and compute 13 Q7 MFCC coefficients.

SYN_Status syn_mfcc_process_frame (
    SYN_MFCC * mfcc,
    const int16_t * pcm_in,
    q7_t mfcc_out
) 

Parameters:

  • mfcc Pointer to MFCC context.
  • pcm_in Array of 16-bit PCM input samples (length = fft_size).
  • mfcc_out Output buffer for 13 Q7 MFCC coefficients.

Returns:

SYN_OK on success, SYN_INVALID_PARAM if NULL.


Macro Definition Documentation

define SYN_MFCC_MAX_FFT_SIZE

#define SYN_MFCC_MAX_FFT_SIZE `128U`

Maximum supported FFT length (128 samples)


define SYN_MFCC_NUM_COEFFS

#define SYN_MFCC_NUM_COEFFS `13U`

Retained MFCC cepstral coefficient count (13)


define SYN_MFCC_NUM_MEL_FILTERS

#define SYN_MFCC_NUM_MEL_FILTERS `26U`

Standard Mel filterbank count (26 filters)



The documentation for this class was generated from the following file src/syntropic/dsp/syn_mfcc.h