\doxysection{include/sphinxbase/agc.h File Reference}
\label{agc_8h}\index{include/sphinxbase/agc.h@{include/sphinxbase/agc.h}}


routine that implements automatic gain control  


{\ttfamily \#include $<$sphinxbase/sphinxbase\+\_\+export.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/prim\+\_\+type.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/fe.\+h$>$}\newline
\doxysubsubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ agc\+\_\+s}
\begin{DoxyCompactList}\small\item\em Structure holding data for doing AGC. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\label{agc_8h_a5b94b552491115c4eae2ed0eef5bf9dc} 
typedef enum \textbf{ agc\+\_\+type\+\_\+e} {\bfseries agc\+\_\+type\+\_\+t}
\begin{DoxyCompactList}\small\item\em Types of acoustic gain control to apply to the features. \end{DoxyCompactList}\item 
\label{agc_8h_a5cd32209fe5e74ed52e93011ed38b22a} 
typedef struct \textbf{ agc\+\_\+s} {\bfseries agc\+\_\+t}
\begin{DoxyCompactList}\small\item\em Structure holding data for doing AGC. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \textbf{ agc\+\_\+type\+\_\+e} \{ {\bfseries AGC\+\_\+\+NONE} = 0
, {\bfseries AGC\+\_\+\+MAX}
, {\bfseries AGC\+\_\+\+EMAX}
, {\bfseries AGC\+\_\+\+NOISE}
 \}
\begin{DoxyCompactList}\small\item\em Types of acoustic gain control to apply to the features. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ agc\+\_\+type\+\_\+t} \textbf{ agc\+\_\+type\+\_\+from\+\_\+str} (const char $\ast$str)
\begin{DoxyCompactList}\small\item\em Convert string representation (from command-\/line) to agc\+\_\+type\+\_\+t. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ agc\+\_\+t} $\ast$ \textbf{ agc\+\_\+init} (void)
\begin{DoxyCompactList}\small\item\em Initialize AGC structure with default values. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ agc\+\_\+free} (\textbf{ agc\+\_\+t} $\ast$agc)
\begin{DoxyCompactList}\small\item\em Free AGC structure. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ agc\+\_\+max} (\textbf{ agc\+\_\+t} $\ast$agc, mfcc\+\_\+t $\ast$$\ast$mfc, int32 n\+\_\+frame)
\begin{DoxyCompactList}\small\item\em 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). \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ agc\+\_\+emax} (\textbf{ agc\+\_\+t} $\ast$agc, mfcc\+\_\+t $\ast$$\ast$mfc, int32 n\+\_\+frame)
\begin{DoxyCompactList}\small\item\em Apply AGC to the given block of MFC vectors. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ agc\+\_\+emax\+\_\+update} (\textbf{ agc\+\_\+t} $\ast$agc)
\begin{DoxyCompactList}\small\item\em Update AGC parameters for next utterance. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT float32 \textbf{ agc\+\_\+emax\+\_\+get} (\textbf{ agc\+\_\+t} $\ast$agc)
\begin{DoxyCompactList}\small\item\em Get the current AGC maximum estimate. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ agc\+\_\+emax\+\_\+set} (\textbf{ agc\+\_\+t} $\ast$agc, float32 m)
\begin{DoxyCompactList}\small\item\em Set the current AGC maximum estimate. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ agc\+\_\+noise} (\textbf{ agc\+\_\+t} $\ast$agc, mfcc\+\_\+t $\ast$$\ast$mfc, int32 n\+\_\+frame)
\begin{DoxyCompactList}\small\item\em Apply AGC using noise threshold to the given block of MFC vectors. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT float32 \textbf{ agc\+\_\+get\+\_\+threshold} (\textbf{ agc\+\_\+t} $\ast$agc)
\begin{DoxyCompactList}\small\item\em Get the current AGC noise threshold. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ agc\+\_\+set\+\_\+threshold} (\textbf{ agc\+\_\+t} $\ast$agc, float32 threshold)
\begin{DoxyCompactList}\small\item\em Set the current AGC noise threshold. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
SPHINXBASE\+\_\+\+EXPORT const char $\ast$ \textbf{ agc\+\_\+type\+\_\+str} [$\,$]
\begin{DoxyCompactList}\small\item\em String representations of agc\+\_\+type\+\_\+t values. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
routine that implements automatic gain control 

\begin{DoxyWarning}{Warning}
This function may not be fully compatible with Sphinx\+Train\textquotesingle{}s family of AGC.
\end{DoxyWarning}
This implements AGC. 

Definition in file \textbf{ agc.\+h}.



\doxysubsection{Enumeration Type Documentation}
\label{agc_8h_aef1d2c7e32d37aa84d70c2f3675fc923} 
\index{agc.h@{agc.h}!agc\_type\_e@{agc\_type\_e}}
\index{agc\_type\_e@{agc\_type\_e}!agc.h@{agc.h}}
\doxysubsubsection{agc\_type\_e}
{\footnotesize\ttfamily enum \textbf{ agc\+\_\+type\+\_\+e}}



Types of acoustic gain control to apply to the features. 



Definition at line \textbf{ 95} of file \textbf{ agc.\+h}.



\doxysubsection{Function Documentation}
\label{agc_8h_ac2cdd4c519b46824c5b28c5b769b5ecd} 
\index{agc.h@{agc.h}!agc\_emax@{agc\_emax}}
\index{agc\_emax@{agc\_emax}!agc.h@{agc.h}}
\doxysubsubsection{agc\_emax()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void agc\+\_\+emax (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc,  }\item[{mfcc\+\_\+t $\ast$$\ast$}]{mfc,  }\item[{int32}]{n\+\_\+frame }\end{DoxyParamCaption})}



Apply AGC to the given block of MFC vectors. 

Unlike \doxyref{agc\+\_\+max()}{p.}{agc_8h_a29a2a4dd80141af1c3476094c353b739} this does not require the entire utterance to be available. Call \doxyref{agc\+\_\+emax\+\_\+update()}{p.}{agc_8h_af47b6004f2f963ae0019a67450b892c2} at the end of each utterance to update the AGC parameters. 
\begin{DoxyParams}{Parameters}
{\em agc} & In\+: AGC structure  \\
\hline
{\em mfc} & In/\+Out\+: mfc[f] = cepstrum vector in frame f  \\
\hline
{\em n\+\_\+frame} & In\+: number of frames of cepstrum vectors supplied \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 142} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+emax()}, \textbf{ agc\+\_\+s\+::max}, \textbf{ agc\+\_\+s\+::obs\+\_\+frame}, and \textbf{ agc\+\_\+s\+::obs\+\_\+max}.



Referenced by \textbf{ agc\+\_\+emax()}.

\label{agc_8h_a7b439fb5d36250d09bb9d459c1e28ba5} 
\index{agc.h@{agc.h}!agc\_emax\_get@{agc\_emax\_get}}
\index{agc\_emax\_get@{agc\_emax\_get}!agc.h@{agc.h}}
\doxysubsubsection{agc\_emax\_get()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT float32 agc\+\_\+emax\+\_\+get (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc }\end{DoxyParamCaption})}



Get the current AGC maximum estimate. 



Definition at line \textbf{ 136} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+emax\+\_\+get()}, and \textbf{ agc\+\_\+s\+::max}.



Referenced by \textbf{ agc\+\_\+emax\+\_\+get()}.

\label{agc_8h_a4fd17f224b5d8f7bfcaa9389d11716eb} 
\index{agc.h@{agc.h}!agc\_emax\_set@{agc\_emax\_set}}
\index{agc\_emax\_set@{agc\_emax\_set}!agc.h@{agc.h}}
\doxysubsubsection{agc\_emax\_set()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void agc\+\_\+emax\+\_\+set (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc,  }\item[{float32}]{m }\end{DoxyParamCaption})}



Set the current AGC maximum estimate. 



Definition at line \textbf{ 129} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+emax\+\_\+set()}, \textbf{ E\+\_\+\+INFO}, and \textbf{ agc\+\_\+s\+::max}.



Referenced by \textbf{ agc\+\_\+emax\+\_\+set()}, and \textbf{ feat\+\_\+init()}.

\label{agc_8h_af47b6004f2f963ae0019a67450b892c2} 
\index{agc.h@{agc.h}!agc\_emax\_update@{agc\_emax\_update}}
\index{agc\_emax\_update@{agc\_emax\_update}!agc.h@{agc.h}}
\doxysubsubsection{agc\_emax\_update()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void agc\+\_\+emax\+\_\+update (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc }\end{DoxyParamCaption})}



Update AGC parameters for next utterance. 


\begin{DoxyParams}{Parameters}
{\em agc} & In\+: AGC structure \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 159} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+emax\+\_\+update()}, \textbf{ E\+\_\+\+INFO}, \textbf{ agc\+\_\+s\+::max}, \textbf{ agc\+\_\+s\+::obs\+\_\+frame}, \textbf{ agc\+\_\+s\+::obs\+\_\+max}, and \textbf{ agc\+\_\+s\+::obs\+\_\+utt}.



Referenced by \textbf{ agc\+\_\+emax\+\_\+update()}.

\label{agc_8h_a6a050fc4b079be05b1946636d5d7f3aa} 
\index{agc.h@{agc.h}!agc\_free@{agc\_free}}
\index{agc\_free@{agc\_free}!agc.h@{agc.h}}
\doxysubsubsection{agc\_free()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void agc\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc }\end{DoxyParamCaption})}



Free AGC structure. 



Definition at line \textbf{ 100} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+free()}, and \textbf{ ckd\+\_\+free()}.



Referenced by \textbf{ agc\+\_\+free()}, and \textbf{ feat\+\_\+free()}.

\label{agc_8h_a77d0987174a1b3c6e8fcd63fe82f33ce} 
\index{agc.h@{agc.h}!agc\_get\_threshold@{agc\_get\_threshold}}
\index{agc\_get\_threshold@{agc\_get\_threshold}!agc.h@{agc.h}}
\doxysubsubsection{agc\_get\_threshold()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT float32 agc\+\_\+get\+\_\+threshold (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc }\end{DoxyParamCaption})}



Get the current AGC noise threshold. 



Definition at line \textbf{ 222} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+get\+\_\+threshold()}, and \textbf{ agc\+\_\+s\+::noise\+\_\+thresh}.



Referenced by \textbf{ agc\+\_\+get\+\_\+threshold()}.

\label{agc_8h_ad61dcf6277271680ec208f9804f7c2ea} 
\index{agc.h@{agc.h}!agc\_init@{agc\_init}}
\index{agc\_init@{agc\_init}!agc.h@{agc.h}}
\doxysubsubsection{agc\_init()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ agc\+\_\+t} $\ast$ agc\+\_\+init (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Initialize AGC structure with default values. 



Definition at line \textbf{ 91} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+init()}, \textbf{ ckd\+\_\+calloc}, and \textbf{ agc\+\_\+s\+::noise\+\_\+thresh}.



Referenced by \textbf{ agc\+\_\+init()}, and \textbf{ feat\+\_\+init()}.

\label{agc_8h_a29a2a4dd80141af1c3476094c353b739} 
\index{agc.h@{agc.h}!agc\_max@{agc\_max}}
\index{agc\_max@{agc\_max}!agc.h@{agc.h}}
\doxysubsubsection{agc\_max()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void agc\+\_\+max (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc,  }\item[{mfcc\+\_\+t $\ast$$\ast$}]{mfc,  }\item[{int32}]{n\+\_\+frame }\end{DoxyParamCaption})}



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). 
\begin{DoxyParams}{Parameters}
{\em agc} & In\+: AGC structure (not used)  \\
\hline
{\em mfc} & In/\+Out\+: mfc[f] = cepstrum vector in frame f  \\
\hline
{\em n\+\_\+frame} & In\+: number of frames of cepstrum vectors supplied \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 109} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+max()}, \textbf{ E\+\_\+\+INFO}, \textbf{ agc\+\_\+s\+::obs\+\_\+frame}, and \textbf{ agc\+\_\+s\+::obs\+\_\+max}.



Referenced by \textbf{ agc\+\_\+max()}.

\label{agc_8h_ae65d4be1d74aea11b7e16e3777272d13} 
\index{agc.h@{agc.h}!agc\_noise@{agc\_noise}}
\index{agc\_noise@{agc\_noise}!agc.h@{agc.h}}
\doxysubsubsection{agc\_noise()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void agc\+\_\+noise (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc,  }\item[{mfcc\+\_\+t $\ast$$\ast$}]{mfc,  }\item[{int32}]{n\+\_\+frame }\end{DoxyParamCaption})}



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


\begin{DoxyParams}{Parameters}
{\em agc} & In\+: AGC structure  \\
\hline
{\em mfc} & In/\+Out\+: mfc[f] = cepstrum vector in frame f  \\
\hline
{\em n\+\_\+frame} & In\+: number of frames of cepstrum vectors supplied \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 180} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+noise()}, \textbf{ E\+\_\+\+INFO}, and \textbf{ agc\+\_\+s\+::noise\+\_\+thresh}.



Referenced by \textbf{ agc\+\_\+noise()}.

\label{agc_8h_aaaa9e15f192c91ad64c343b7c6db6714} 
\index{agc.h@{agc.h}!agc\_set\_threshold@{agc\_set\_threshold}}
\index{agc\_set\_threshold@{agc\_set\_threshold}!agc.h@{agc.h}}
\doxysubsubsection{agc\_set\_threshold()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void agc\+\_\+set\+\_\+threshold (\begin{DoxyParamCaption}\item[{\textbf{ agc\+\_\+t} $\ast$}]{agc,  }\item[{float32}]{threshold }\end{DoxyParamCaption})}



Set the current AGC noise threshold. 



Definition at line \textbf{ 216} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+set\+\_\+threshold()}, and \textbf{ agc\+\_\+s\+::noise\+\_\+thresh}.



Referenced by \textbf{ agc\+\_\+set\+\_\+threshold()}.

\label{agc_8h_aebd0689591488378192e13f6d2646bc1} 
\index{agc.h@{agc.h}!agc\_type\_from\_str@{agc\_type\_from\_str}}
\index{agc\_type\_from\_str@{agc\_type\_from\_str}!agc.h@{agc.h}}
\doxysubsubsection{agc\_type\_from\_str()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ agc\+\_\+type\+\_\+t} agc\+\_\+type\+\_\+from\+\_\+str (\begin{DoxyParamCaption}\item[{const char $\ast$}]{str }\end{DoxyParamCaption})}



Convert string representation (from command-\/line) to agc\+\_\+type\+\_\+t. 



Definition at line \textbf{ 79} of file \textbf{ agc.\+c}.



References \textbf{ agc\+\_\+type\+\_\+from\+\_\+str()}, \textbf{ agc\+\_\+type\+\_\+str}, and \textbf{ E\+\_\+\+FATAL}.



Referenced by \textbf{ agc\+\_\+type\+\_\+from\+\_\+str()}.



\doxysubsection{Variable Documentation}
\label{agc_8h_a6ea1b2b3d482cf08eb36084629503c80} 
\index{agc.h@{agc.h}!agc\_type\_str@{agc\_type\_str}}
\index{agc\_type\_str@{agc\_type\_str}!agc.h@{agc.h}}
\doxysubsubsection{agc\_type\_str}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT const char$\ast$ agc\+\_\+type\+\_\+str[$\,$]\hspace{0.3cm}{\ttfamily [extern]}}



String representations of agc\+\_\+type\+\_\+t values. 



Definition at line \textbf{ 70} of file \textbf{ agc.\+c}.



Referenced by \textbf{ agc\+\_\+type\+\_\+from\+\_\+str()}, and \textbf{ feat\+\_\+init()}.

