PocketSphinx  5.0.0
A small speech recognizer
Public Member Functions | List of all members
ps_vad_t Struct Reference

Voice activity detector. More...

#include <pocketsphinx/vad.h>

Public Member Functions

POCKETSPHINX_EXPORT ps_vad_tps_vad_init (ps_vad_mode_t mode, int sample_rate, double frame_length)
 
POCKETSPHINX_EXPORT ps_vad_tps_vad_retain (ps_vad_t *vad)
 
POCKETSPHINX_EXPORT int ps_vad_free (ps_vad_t *vad)
 
POCKETSPHINX_EXPORT int ps_vad_set_input_params (ps_vad_t *vad, int sample_rate, double frame_length)
 
POCKETSPHINX_EXPORT int ps_vad_sample_rate (ps_vad_t *vad)
 
POCKETSPHINX_EXPORT size_t ps_vad_frame_size (ps_vad_t *vad)
 
POCKETSPHINX_EXPORT ps_vad_class_t ps_vad_classify (ps_vad_t *vad, const int16 *frame)
 

Detailed Description

Voice activity detector.

Member Function Documentation

◆ ps_vad_init()

POCKETSPHINX_EXPORT ps_vad_t * ps_vad_init ( ps_vad_mode_t  mode,
int  sample_rate,
double  frame_length 
)

Initialize voice activity detection.

Parameters
mode"Aggressiveness" of voice activity detection. Stricter values (see ps_vad_mode_t) are less likely to misclassify non-speech as speech.
sample_rateSampling rate of input, or 0 for default (which can be obtained with ps_vad_sample_rate()). Only 8000, 16000, 32000, 48000 are directly supported. See ps_vad_set_input_params() for more information.
frame_lengthFrame length in seconds, or 0.0 for the default. Only 0.01, 0.02, 0.03 currently supported. Actual value may differ, you must use ps_vad_frame_length() to obtain it.
Returns
VAD object or NULL on failure (invalid parameter for instance).

◆ ps_vad_retain()

POCKETSPHINX_EXPORT ps_vad_t * ps_vad_retain ( ps_vad_t vad)

Retain a pointer to voice activity detector.

Parameters
vadVoice activity detector.
Returns
Voice activity detector with incremented reference count.

◆ ps_vad_free()

POCKETSPHINX_EXPORT int ps_vad_free ( ps_vad_t vad)

Release a pointer to voice activity detector.

Parameters
vadVoice activity detector.
Returns
New reference count (0 if freed).

◆ ps_vad_set_input_params()

POCKETSPHINX_EXPORT int ps_vad_set_input_params ( ps_vad_t vad,
int  sample_rate,
double  frame_length 
)

Set the input parameters for voice activity detection.

Parameters
sample_rateSampling rate of input, or 0 for default (which can be obtained with ps_vad_sample_rate()). Only 8000, 16000, 32000, 48000 are directly supported, others will use the closest supported rate (within reason). Note that this means that the actual frame length may not be exactly the one requested, so you must always use the one returned by ps_vad_frame_size() (in samples) or ps_vad_frame_length() (in seconds).
frame_lengthRequested frame length in seconds, or 0.0 for the default. Only 0.01, 0.02, 0.03 currently supported. Actual frame length may be different, you must always use ps_vad_frame_length() to obtain it.
Returns
0 for success or -1 on error.

◆ ps_vad_sample_rate()

POCKETSPHINX_EXPORT int ps_vad_sample_rate ( ps_vad_t vad)

Get the sampling rate expected by voice activity detection.

Parameters
vadVoice activity detector.
Returns
Expected sampling rate.

◆ ps_vad_frame_size()

POCKETSPHINX_EXPORT size_t ps_vad_frame_size ( ps_vad_t vad)

Get the number of samples expected by voice activity detection.

You must always ensure that the buffers passed to ps_vad_classify() contain this number of samples (zero-pad them if necessary).

Parameters
vadVoice activity detector.
Returns
Size, in samples, of the frames passed to ps_vad_classify().

◆ ps_vad_classify()

POCKETSPHINX_EXPORT ps_vad_class_t ps_vad_classify ( ps_vad_t vad,
const int16 *  frame 
)

Classify a frame as speech or not speech.

Parameters
vadVoice activity detector.
frameFrame of input, must contain the number of samples returned by ps_vad_frame_size().
Returns
PS_VAD_SPEECH, PS_VAD_NOT_SPEECH, or PS_VAD_ERROR (see ps_vad_class_t).

The documentation for this struct was generated from the following file: