Sound Open Firmware
Loading...
Searching...
No Matches
mfcc_vad.h File Reference

Voice Activity Detection based on Mel spectrum energy. More...

Include dependency graph for mfcc_vad.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mfcc_vad_state
 VAD state structure. More...

Macros

#define MFCC_VAD_NOISE_INIT_FRAMES   100
 Number of frames for fast noise floor convergence at startup (~1 s at 10 ms/frame).
#define MFCC_VAD_NOISE_RISE_ALPHA   98
 Slow noise floor rise coefficient in Q1.15 (0.003 * 2^15).
#define MFCC_VAD_NOISE_RISE_ALPHA_FAST   655
 Fast noise floor rise coefficient in Q1.15 (0.020 * 2^15).
#define MFCC_VAD_ENERGY_THRESHOLD   2516582
 Energy threshold for speech detection in Q9.23 (0.30 * 2^23).
#define MFCC_VAD_HANGOVER_FRAMES   20
 Hangover frame count to keep VAD active after last speech detection.

Functions

int mfcc_vad_init (struct mfcc_vad_state *vad, int num_mel_bins, int32_t sample_rate, struct processing_module *mod)
 Initialize VAD state.
int mfcc_vad_update (struct mfcc_vad_state *vad, const int32_t *mel_log)
 Process one Mel spectrum frame and update VAD decision.

Detailed Description

Voice Activity Detection based on Mel spectrum energy.

This VAD operates on the Q9.23 Mel log spectrum values produced by the MFCC component. It tracks a per-bin noise floor that follows the signal downward instantly and rises slowly, then computes a speech-weighted energy delta above the floor.

Macro Definition Documentation

◆ MFCC_VAD_ENERGY_THRESHOLD

#define MFCC_VAD_ENERGY_THRESHOLD   2516582

Energy threshold for speech detection in Q9.23 (0.30 * 2^23).

◆ MFCC_VAD_HANGOVER_FRAMES

#define MFCC_VAD_HANGOVER_FRAMES   20

Hangover frame count to keep VAD active after last speech detection.

◆ MFCC_VAD_NOISE_INIT_FRAMES

#define MFCC_VAD_NOISE_INIT_FRAMES   100

Number of frames for fast noise floor convergence at startup (~1 s at 10 ms/frame).

◆ MFCC_VAD_NOISE_RISE_ALPHA

#define MFCC_VAD_NOISE_RISE_ALPHA   98

Slow noise floor rise coefficient in Q1.15 (0.003 * 2^15).

◆ MFCC_VAD_NOISE_RISE_ALPHA_FAST

#define MFCC_VAD_NOISE_RISE_ALPHA_FAST   655

Fast noise floor rise coefficient in Q1.15 (0.020 * 2^15).

Function Documentation

◆ mfcc_vad_init()

int mfcc_vad_init ( struct mfcc_vad_state * vad,
int num_mel_bins,
int32_t sample_rate,
struct processing_module * mod )

Initialize VAD state.

Parameters
[out]vadPointer to VAD state to initialize.
[in]num_mel_binsNumber of Mel bins.
[in]sample_rateAudio sample rate in Hz.
[in]modProcessing module for memory allocation.
Returns
0 on success, negative error code on failure.

◆ mfcc_vad_update()

int mfcc_vad_update ( struct mfcc_vad_state * vad,
const int32_t * mel_log )

Process one Mel spectrum frame and update VAD decision.

Parameters
[in,out]vadPointer to VAD state.
[in]mel_logMel log spectrum in Q9.23, array of num_mel_bins values.
Returns
1 if speech detected, 0 if silence.