SphinxBase 5prealpha
agc.h
Go to the documentation of this file.
1/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/* ====================================================================
3 * Copyright (c) 1999-2004 Carnegie Mellon University. All rights
4 * reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 *
18 * This work was supported in part by funding from the Defense Advanced
19 * Research Projects Agency and the National Science Foundation of the
20 * United States of America, and the CMU Sphinx Speech Consortium.
21 *
22 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
23 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
26 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * ====================================================================
35 *
36 */
37/*
38 * agc.h -- Various forms of automatic gain control (AGC)
39 *
40 * **********************************************
41 * CMU ARPA Speech Project
42 *
43 * Copyright (c) 1999 Carnegie Mellon University.
44 * ALL RIGHTS RESERVED.
45 * **********************************************
46 *
47 * HISTORY
48 * $Log$
49 * Revision 1.1 2006/04/05 20:27:30 dhdfu
50 * A Great Reorganzation of header files and executables
51 *
52 * Revision 1.8 2005/06/21 19:25:41 arthchan2003
53 * 1, Fixed doxygen documentation. 2, Added $ keyword.
54 *
55 * Revision 1.4 2005/06/13 04:02:56 archan
56 * Fixed most doxygen-style documentation under libs3decoder.
57 *
58 * Revision 1.3 2005/03/30 01:22:46 archan
59 * Fixed mistakes in last updates. Add
60 *
61 *
62 * 28-Apr-1999 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
63 * Copied from previous version.
64 */
65
66
67#ifndef _S3_AGC_H_
68#define _S3_AGC_H_
69
70/* Win32/WinCE DLL gunk */
71#include <sphinxbase/sphinxbase_export.h>
72
74#include <sphinxbase/fe.h>
75
84#ifdef __cplusplus
85extern "C" {
86#endif
87#if 0
88/* Fool Emacs. */
89}
90#endif
91
95typedef enum agc_type_e {
96 AGC_NONE = 0,
97 AGC_MAX,
98 AGC_EMAX,
99 AGC_NOISE
101
103SPHINXBASE_EXPORT
104agc_type_t agc_type_from_str(const char *str);
105
107SPHINXBASE_EXPORT
108extern const char *agc_type_str[];
109
113typedef struct agc_s {
114 mfcc_t max;
115 mfcc_t obs_max;
116 int32 obs_frame;
117 int32 obs_utt;
118 mfcc_t obs_max_sum;
121
125SPHINXBASE_EXPORT
126agc_t *agc_init(void);
127
131SPHINXBASE_EXPORT
132void agc_free(agc_t *agc);
133
140SPHINXBASE_EXPORT
141void agc_max(agc_t *agc,
142 mfcc_t **mfc,
143 int32 n_frame
144 );
145
151SPHINXBASE_EXPORT
152void agc_emax(agc_t *agc,
153 mfcc_t **mfc,
154 int32 n_frame
155 );
156
160SPHINXBASE_EXPORT
161void agc_emax_update(agc_t *agc
162 );
163
167SPHINXBASE_EXPORT
168float32 agc_emax_get(agc_t *agc);
169
173SPHINXBASE_EXPORT
174void agc_emax_set(agc_t *agc, float32 m);
175
179SPHINXBASE_EXPORT
180void agc_noise(agc_t *agc,
181 mfcc_t **mfc,
182 int32 n_frame
183 );
184
188SPHINXBASE_EXPORT
189float32 agc_get_threshold(agc_t *agc);
190
194SPHINXBASE_EXPORT
195void agc_set_threshold(agc_t *agc, float32 threshold);
196
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif
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 th...
Definition agc.c:109
SPHINXBASE_EXPORT void agc_emax_set(agc_t *agc, float32 m)
Set the current AGC maximum estimate.
Definition agc.c:129
enum agc_type_e agc_type_t
Types of acoustic gain control to apply to the features.
struct agc_s agc_t
Structure holding data for doing AGC.
SPHINXBASE_EXPORT void agc_free(agc_t *agc)
Free AGC structure.
Definition agc.c:100
SPHINXBASE_EXPORT const char * agc_type_str[]
String representations of agc_type_t values.
Definition agc.c:70
SPHINXBASE_EXPORT float32 agc_get_threshold(agc_t *agc)
Get the current AGC noise threshold.
Definition agc.c:224
SPHINXBASE_EXPORT float32 agc_emax_get(agc_t *agc)
Get the current AGC maximum estimate.
Definition agc.c:136
SPHINXBASE_EXPORT void agc_set_threshold(agc_t *agc, float32 threshold)
Set the current AGC noise threshold.
Definition agc.c:218
SPHINXBASE_EXPORT void agc_emax(agc_t *agc, mfcc_t **mfc, int32 n_frame)
Apply AGC to the given block of MFC vectors.
Definition agc.c:142
SPHINXBASE_EXPORT agc_t * agc_init(void)
Initialize AGC structure with default values.
Definition agc.c:91
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.
Definition agc.c:180
SPHINXBASE_EXPORT agc_type_t agc_type_from_str(const char *str)
Convert string representation (from command-line) to agc_type_t.
Definition agc.c:79
agc_type_e
Types of acoustic gain control to apply to the features.
Definition agc.h:95
SPHINXBASE_EXPORT void agc_emax_update(agc_t *agc)
Update AGC parameters for next utterance.
Definition agc.c:159
Basic type definitions used in Sphinx.
Structure holding data for doing AGC.
Definition agc.h:113
mfcc_t obs_max
Observed max in current utterance.
Definition agc.h:115
mfcc_t noise_thresh
Noise threshold (for AGC_NOISE only)
Definition agc.h:119
int32 obs_frame
Whether any data was observed after prev update.
Definition agc.h:116
mfcc_t max
Estimated max for current utterance (for AGC_EMAX)
Definition agc.h:114
int32 obs_utt
Whether any utterances have been observed.
Definition agc.h:117