SphinxBase 0.6

include/sphinxbase/agc.h

Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
00002 /* ====================================================================
00003  * Copyright (c) 1999-2004 Carnegie Mellon University.  All rights
00004  * reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * 1. Redistributions of source code must retain the above copyright
00011  *    notice, this list of conditions and the following disclaimer. 
00012  *
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in
00015  *    the documentation and/or other materials provided with the
00016  *    distribution.
00017  *
00018  * This work was supported in part by funding from the Defense Advanced 
00019  * Research Projects Agency and the National Science Foundation of the 
00020  * United States of America, and the CMU Sphinx Speech Consortium.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
00023  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00024  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00025  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
00026  * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00027  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
00028  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
00029  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
00030  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
00032  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  *
00034  * ====================================================================
00035  *
00036  */
00037 /*
00038  * agc.h -- Various forms of automatic gain control (AGC)
00039  * 
00040  * **********************************************
00041  * CMU ARPA Speech Project
00042  *
00043  * Copyright (c) 1999 Carnegie Mellon University.
00044  * ALL RIGHTS RESERVED.
00045  * **********************************************
00046  * 
00047  * HISTORY
00048  * $Log$
00049  * Revision 1.1  2006/04/05  20:27:30  dhdfu
00050  * A Great Reorganzation of header files and executables
00051  * 
00052  * Revision 1.8  2005/06/21 19:25:41  arthchan2003
00053  * 1, Fixed doxygen documentation. 2, Added $ keyword.
00054  *
00055  * Revision 1.4  2005/06/13 04:02:56  archan
00056  * Fixed most doxygen-style documentation under libs3decoder.
00057  *
00058  * Revision 1.3  2005/03/30 01:22:46  archan
00059  * Fixed mistakes in last updates. Add
00060  *
00061  * 
00062  * 28-Apr-1999  M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
00063  *              Copied from previous version.
00064  */
00065 
00066 
00067 #ifndef _S3_AGC_H_
00068 #define _S3_AGC_H_
00069 
00070 /* Win32/WinCE DLL gunk */
00071 #include <sphinxbase/sphinxbase_export.h>
00072 
00073 #include <sphinxbase/prim_type.h>
00074 #include <sphinxbase/fe.h>
00075 
00084 #ifdef __cplusplus
00085 extern "C" {
00086 #endif
00087 #if 0
00088 /* Fool Emacs. */
00089 }
00090 #endif
00091 
00095 typedef enum agc_type_e {
00096     AGC_NONE = 0,
00097     AGC_MAX,
00098     AGC_EMAX,
00099     AGC_NOISE
00100 } agc_type_t;
00101 
00103 SPHINXBASE_EXPORT
00104 agc_type_t agc_type_from_str(const char *str);
00105 
00107 SPHINXBASE_EXPORT
00108 extern const char *agc_type_str[];
00109 
00113 typedef struct agc_s {
00114     mfcc_t max;      
00115     mfcc_t obs_max;  
00116     int32 obs_frame; 
00117     int32 obs_utt;   
00118     mfcc_t obs_max_sum;
00119     mfcc_t noise_thresh; 
00120 } agc_t;
00121 
00125 SPHINXBASE_EXPORT
00126 agc_t *agc_init(void);
00127 
00131 SPHINXBASE_EXPORT
00132 void agc_free(agc_t *agc);
00133 
00140 SPHINXBASE_EXPORT
00141 void agc_max(agc_t *agc,        
00142              mfcc_t **mfc,      
00143              int32 n_frame      
00144     );
00145 
00151 SPHINXBASE_EXPORT
00152 void agc_emax(agc_t *agc,       
00153               mfcc_t **mfc,     
00154               int32 n_frame     
00155     );
00156 
00160 SPHINXBASE_EXPORT
00161 void agc_emax_update(agc_t *agc 
00162     );
00163 
00167 SPHINXBASE_EXPORT
00168 float32 agc_emax_get(agc_t *agc);
00169 
00173 SPHINXBASE_EXPORT
00174 void agc_emax_set(agc_t *agc, float32 m);
00175 
00179 SPHINXBASE_EXPORT
00180 void agc_noise(agc_t *agc,      
00181                mfcc_t **mfc,    
00182                int32 n_frame    
00183     );
00184 
00188 SPHINXBASE_EXPORT
00189 float32 agc_get_threshold(agc_t *agc);
00190 
00194 SPHINXBASE_EXPORT
00195 void agc_set_threshold(agc_t *agc, float32 threshold);
00196 
00197 
00198 #ifdef __cplusplus
00199 }
00200 #endif
00201 
00202 #endif