agc.h File Reference

routine that implements automatic gain control More...

`#include <sphinxbase/sphinxbase_export.h>`
`#include <sphinxbase/prim_type.h>`
`#include <sphinxbase/fe.h>`

Go to the source code of this file.

## Data Structures

struct | agc_s
| Structure holding data for doing AGC. More...

## Typedefs

typedef enum agc_type_e | agc_type_t
| Types of acoustic gain control to apply to the features.
typedef struct agc_s | agc_t
| Structure holding data for doing AGC.

## Enumerations

enum | agc_type_e { AGC_NONE = 0, AGC_MAX, AGC_EMAX, AGC_NOISE }
| Types of acoustic gain control to apply to the features.

## Functions

SPHINXBASE_EXPORT agc_type_t | agc_type_from_str (const char *str)
| Convert string representation (from command-line) to agc_type_t.
SPHINXBASE_EXPORT agc_t * | agc_init (void)
| Initialize AGC structure with default values.
SPHINXBASE_EXPORT void | agc_free (agc_t *agc)
| Free AGC structure.
SPHINXBASE_EXPORT void | agc_max (agc_t *agc, mfcc_t **mfc, int32 n_frame)
| Apply AGC to the given mfc vectors (normalize all C0 mfc coefficients in the given input such that the max C0 value is 0, by subtracting the input max C0 from all). More...
SPHINXBASE_EXPORT void | agc_emax (agc_t *agc, mfcc_t **mfc, int32 n_frame)
| Apply AGC to the given block of MFC vectors. More...
SPHINXBASE_EXPORT void | agc_emax_update (agc_t *agc)
| Update AGC parameters for next utterance. More...
SPHINXBASE_EXPORT float32 | agc_emax_get (agc_t *agc)
| Get the current AGC maximum estimate.
SPHINXBASE_EXPORT void | agc_emax_set (agc_t *agc, float32 m)
| Set the current AGC maximum estimate.
SPHINXBASE_EXPORT void | agc_noise (agc_t *agc, mfcc_t **mfc, int32 n_frame)
| Apply AGC using noise threshold to the given block of MFC vectors. More...
SPHINXBASE_EXPORT float32 | agc_get_threshold (agc_t *agc)
| Get the current AGC noise threshold.
SPHINXBASE_EXPORT void | agc_set_threshold (agc_t *agc, float32 threshold)
| Set the current AGC noise threshold.

## Variables

SPHINXBASE_EXPORT const char * | agc_type_str []
| String representations of agc_type_t values. More...

## Detailed Description

routine that implements automatic gain control

Warning
  This function may not be fully compatible with SphinxTrain's family of AGC.

This implements AGC.

Definition in file agc.h.

## Function Documentation

SPHINXBASE_EXPORT void agc_emax | ( | agc_t * | agc,
|  | mfcc_t ** | mfc,
|  | int32 | n_frame
| ) |  |

Apply AGC to the given block of MFC vectors.

Unlike agc_max() this does not require the entire utterance to be available. Call agc_emax_update() at the end of each utterance to update the AGC parameters.

Parameters

  agc | In: AGC structure
  mfc | In/Out: mfc[f] = cepstrum vector in frame f
  n_frame | In: number of frames of cepstrum vectors supplied

Definition at line 142 of file agc.c.

References agc_s::max, agc_s::obs_frame, and agc_s::obs_max.

SPHINXBASE_EXPORT void agc_emax_update | ( | agc_t * | agc | ) |

Update AGC parameters for next utterance.

Parameters

  agc | In: AGC structure

Definition at line 159 of file agc.c.

References E_INFO, agc_s::max, agc_s::obs_frame, agc_s::obs_max, and agc_s::obs_utt.

SPHINXBASE_EXPORT void agc_max | ( | agc_t * | agc,
|  | mfcc_t ** | mfc,
|  | int32 | n_frame
| ) |  |

Apply AGC to the given mfc vectors (normalize all C0 mfc coefficients in the given input such that the max C0 value is 0, by subtracting the input max C0 from all).

This function operates on an entire utterance at a time. Hence, the entire utterance must be available beforehand (batchmode).

Apply AGC to the given mfc vectors (normalize all C0 mfc coefficients in the given input such that the max C0 value is 0, by subtracting the input max C0 from all).

Parameters

  agc | In: AGC structure (not used)
  mfc | In/Out: mfc[f] = cepstrum vector in frame f
  n_frame | In: number of frames of cepstrum vectors supplied

Definition at line 109 of file agc.c.

References E_INFO, agc_s::obs_frame, and agc_s::obs_max.

SPHINXBASE_EXPORT void agc_noise | ( | agc_t * | agc,
|  | mfcc_t ** | mfc,
|  | int32 | n_frame
| ) |  |

Apply AGC using noise threshold to the given block of MFC vectors.

Parameters

  agc | In: AGC structure
  mfc | In/Out: mfc[f] = cepstrum vector in frame f
  n_frame | In: number of frames of cepstrum vectors supplied

Definition at line 180 of file agc.c.

References E_INFO, and agc_s::noise_thresh.

## Variable Documentation

SPHINXBASE_EXPORT const char* agc_type_str[]

String representations of agc_type_t values.

Definition at line 70 of file agc.c.

Referenced by agc_type_from_str(), and feat_init().