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. More...

## 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).
SPHINXBASE_EXPORT void | agc_emax (agc_t *agc, mfcc_t **mfc, int32 n_frame)
| Apply AGC to the given block of MFC vectors.
SPHINXBASE_EXPORT void | agc_emax_update (agc_t *agc)
| Update AGC parameters for next utterance.
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.
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.

## 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.

## Enumeration Type Documentation

## agc_type_e

enum agc_type_e

Types of acoustic gain control to apply to the features.

Definition at line 95 of file agc.h.

## Function Documentation

## agc_emax()

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_emax(), agc_s::max, agc_s::obs_frame, and agc_s::obs_max.

Referenced by agc_emax().

## agc_emax_get()

SPHINXBASE_EXPORT float32 agc_emax_get | ( | agc_t * | agc | ) |

Get the current AGC maximum estimate.

Definition at line 136 of file agc.c.

References agc_emax_get(), and agc_s::max.

Referenced by agc_emax_get().

## agc_emax_set()

SPHINXBASE_EXPORT void agc_emax_set | ( | agc_t * | agc,
|  | float32 | m )

Set the current AGC maximum estimate.

Definition at line 129 of file agc.c.

References agc_emax_set(), E_INFO, and agc_s::max.

Referenced by agc_emax_set(), and feat_init().

## agc_emax_update()

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 agc_emax_update(), E_INFO, agc_s::max, agc_s::obs_frame, agc_s::obs_max, and agc_s::obs_utt.

Referenced by agc_emax_update(), and feat_update_stats().

## agc_free()

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

Free AGC structure.

Definition at line 100 of file agc.c.

References agc_free(), and ckd_free().

Referenced by agc_free(), and feat_free().

## agc_get_threshold()

SPHINXBASE_EXPORT float32 agc_get_threshold | ( | agc_t * | agc | ) |

Get the current AGC noise threshold.

Definition at line 224 of file agc.c.

References agc_get_threshold(), and agc_s::noise_thresh.

Referenced by agc_get_threshold().

## agc_init()

SPHINXBASE_EXPORT agc_t * agc_init | ( | void |  | ) |

Initialize AGC structure with default values.

Definition at line 91 of file agc.c.

References ckd_calloc, and agc_s::noise_thresh.

Referenced by feat_init().

## agc_max()

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 agc_max(), E_INFO, agc_s::obs_frame, and agc_s::obs_max.

Referenced by agc_max().

## agc_noise()

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 agc_noise(), E_INFO, and agc_s::noise_thresh.

Referenced by agc_noise().

## agc_set_threshold()

SPHINXBASE_EXPORT void agc_set_threshold | ( | agc_t * | agc,
|  | float32 | threshold )

Set the current AGC noise threshold.

Definition at line 218 of file agc.c.

References agc_set_threshold(), and agc_s::noise_thresh.

Referenced by agc_set_threshold().

## agc_type_from_str()

SPHINXBASE_EXPORT agc_type_t agc_type_from_str | ( | const char * | str | ) |

Convert string representation (from command-line) to agc_type_t.

Definition at line 79 of file agc.c.

References agc_type_from_str(), agc_type_str, and E_FATAL.

Referenced by agc_type_from_str().

## Variable Documentation

## agc_type_str

SPHINXBASE_EXPORT const char* agc_type_str[]

extern

String representations of agc_type_t values.

Definition at line 70 of file agc.c.

Referenced by agc_type_from_str(), and feat_init().