\doxysection{include/sphinxbase/yin.h File Reference}
\label{yin_8h}\index{include/sphinxbase/yin.h@{include/sphinxbase/yin.h}}


Implementation of pitch estimation.  


{\ttfamily \#include $<$sphinxbase/sphinxbase\+\_\+export.\+h$>$}\newline
{\ttfamily \#include $<$sphinxbase/prim\+\_\+type.\+h$>$}\newline
\doxysubsubsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef struct \textbf{ yin\+\_\+s} \textbf{ yin\+\_\+t}
\begin{DoxyCompactList}\small\item\em Frame-\/based moving-\/window pitch estimator. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
SPHINXBASE\+\_\+\+EXPORT \textbf{ yin\+\_\+t} $\ast$ \textbf{ yin\+\_\+init} (int frame\+\_\+size, float search\+\_\+threshold, float search\+\_\+range, int smooth\+\_\+window)
\begin{DoxyCompactList}\small\item\em Initialize moving-\/window pitch estimation. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ yin\+\_\+free} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Free a moving-\/window pitch estimator. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ yin\+\_\+start} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Start processing an utterance. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ yin\+\_\+end} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Mark the end of an utterance. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT void \textbf{ yin\+\_\+write} (\textbf{ yin\+\_\+t} $\ast$pe, int16 const $\ast$frame)
\begin{DoxyCompactList}\small\item\em Feed a frame of data to the pitch estimator. \end{DoxyCompactList}\item 
SPHINXBASE\+\_\+\+EXPORT int \textbf{ yin\+\_\+read} (\textbf{ yin\+\_\+t} $\ast$pe, uint16 $\ast$out\+\_\+period, uint16 $\ast$out\+\_\+bestdiff)
\begin{DoxyCompactList}\small\item\em Read a raw estimated pitch value from the pitch estimator. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Implementation of pitch estimation. 

\begin{DoxyAuthor}{Author}
David Huggins-\/\+Daines {\texttt{ dhuggins@cs.\+cmu.\+edu}}
\end{DoxyAuthor}
This implements part of the YIN algorithm\+:

"{}\+YIN, a fundamental frequency estimator for speech and music"{}. Alain de Cheveigné and Hideki Kawahara. Journal of the Acoustical Society of America, 111 (4), April 2002. 

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



\doxysubsection{Typedef Documentation}
\label{yin_8h_a69a22f00f601c099b232e01b94704c2c} 
\index{yin.h@{yin.h}!yin\_t@{yin\_t}}
\index{yin\_t@{yin\_t}!yin.h@{yin.h}}
\doxysubsubsection{yin\_t}
{\footnotesize\ttfamily typedef struct \textbf{ yin\+\_\+s} \textbf{ yin\+\_\+t}}



Frame-\/based moving-\/window pitch estimator. 



Definition at line \textbf{ 59} of file \textbf{ yin.\+h}.



\doxysubsection{Function Documentation}
\label{yin_8h_a9182cabf44e517c2db3b67edacebece9} 
\index{yin.h@{yin.h}!yin\_end@{yin\_end}}
\index{yin\_end@{yin\_end}!yin.h@{yin.h}}
\doxysubsubsection{yin\_end()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void yin\+\_\+end (\begin{DoxyParamCaption}\item[{\textbf{ yin\+\_\+t} $\ast$}]{pe }\end{DoxyParamCaption})}



Mark the end of an utterance. 



Definition at line \textbf{ 165} of file \textbf{ yin.\+c}.



References \textbf{ yin\+\_\+s\+::endut}.

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



Free a moving-\/window pitch estimator. 



Definition at line \textbf{ 149} of file \textbf{ yin.\+c}.



References \textbf{ ckd\+\_\+free()}, \textbf{ ckd\+\_\+free\+\_\+2d()}, \textbf{ yin\+\_\+s\+::diff\+\_\+window}, and \textbf{ yin\+\_\+s\+::period\+\_\+window}.

\label{yin_8h_a94c20d46e06fb50460f5eee4eac7cbba} 
\index{yin.h@{yin.h}!yin\_init@{yin\_init}}
\index{yin\_init@{yin\_init}!yin.h@{yin.h}}
\doxysubsubsection{yin\_init()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT \textbf{ yin\+\_\+t} $\ast$ yin\+\_\+init (\begin{DoxyParamCaption}\item[{int}]{frame\+\_\+size,  }\item[{float}]{search\+\_\+threshold,  }\item[{float}]{search\+\_\+range,  }\item[{int}]{smooth\+\_\+window }\end{DoxyParamCaption})}



Initialize moving-\/window pitch estimation. 



Definition at line \textbf{ 130} of file \textbf{ yin.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+calloc\+\_\+2d}, \textbf{ yin\+\_\+s\+::diff\+\_\+window}, \textbf{ yin\+\_\+s\+::period\+\_\+window}, \textbf{ yin\+\_\+s\+::search\+\_\+range}, \textbf{ yin\+\_\+s\+::search\+\_\+threshold}, and \textbf{ yin\+\_\+s\+::wsize}.

\label{yin_8h_a3a0ae5d5a543b9e71b34c9b4a285bdbf} 
\index{yin.h@{yin.h}!yin\_read@{yin\_read}}
\index{yin\_read@{yin\_read}!yin.h@{yin.h}}
\doxysubsubsection{yin\_read()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT int yin\+\_\+read (\begin{DoxyParamCaption}\item[{\textbf{ yin\+\_\+t} $\ast$}]{pe,  }\item[{uint16 $\ast$}]{out\+\_\+period,  }\item[{uint16 $\ast$}]{out\+\_\+bestdiff }\end{DoxyParamCaption})}



Read a raw estimated pitch value from the pitch estimator. 


\begin{DoxyParams}{Parameters}
{\em pe} & Pitch estimator. \\
\hline
{\em out\+\_\+period} & Output\+: an estimate of the period ({\itshape not} the pitch) of the signal in samples. \\
\hline
{\em out\+\_\+bestdiff} & Output\+: the minimum normalized difference value associated with {\ttfamily $\ast$out\+\_\+pitch}, in Q15 format (i.\+e. scaled by 32768). This can be interpreted as one minus the probability of voicing. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Non-\/zero if enough data was avaliable to return a pitch estimate, zero otherwise. 
\end{DoxyReturn}


Definition at line \textbf{ 221} of file \textbf{ yin.\+c}.



References \textbf{ yin\+\_\+s\+::diff\+\_\+window}, \textbf{ yin\+\_\+s\+::endut}, \textbf{ yin\+\_\+s\+::nfr}, \textbf{ yin\+\_\+s\+::period\+\_\+window}, \textbf{ yin\+\_\+s\+::search\+\_\+range}, \textbf{ yin\+\_\+s\+::search\+\_\+threshold}, \textbf{ yin\+\_\+s\+::wcur}, \textbf{ yin\+\_\+s\+::wsize}, and \textbf{ yin\+\_\+s\+::wstart}.

\label{yin_8h_a9a93d7c0fd3eb97d8ea735a76683ff4d} 
\index{yin.h@{yin.h}!yin\_start@{yin\_start}}
\index{yin\_start@{yin\_start}!yin.h@{yin.h}}
\doxysubsubsection{yin\_start()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void yin\+\_\+start (\begin{DoxyParamCaption}\item[{\textbf{ yin\+\_\+t} $\ast$}]{pe }\end{DoxyParamCaption})}



Start processing an utterance. 



Definition at line \textbf{ 157} of file \textbf{ yin.\+c}.



References \textbf{ yin\+\_\+s\+::endut}, \textbf{ yin\+\_\+s\+::nfr}, and \textbf{ yin\+\_\+s\+::wstart}.

\label{yin_8h_ac316a9b80593ad996df71b0f6df54d6c} 
\index{yin.h@{yin.h}!yin\_write@{yin\_write}}
\index{yin\_write@{yin\_write}!yin.h@{yin.h}}
\doxysubsubsection{yin\_write()}
{\footnotesize\ttfamily SPHINXBASE\+\_\+\+EXPORT void yin\+\_\+write (\begin{DoxyParamCaption}\item[{\textbf{ yin\+\_\+t} $\ast$}]{pe,  }\item[{int16 const $\ast$}]{frame }\end{DoxyParamCaption})}



Feed a frame of data to the pitch estimator. 


\begin{DoxyParams}{Parameters}
{\em pe} & Pitch estimator. \\
\hline
{\em frame} & Frame of {\ttfamily frame\+\_\+size} (see \doxyref{yin\+\_\+init()}{p.}{yin_8h_a94c20d46e06fb50460f5eee4eac7cbba}) samples of audio data. \\
\hline
\end{DoxyParams}


Definition at line \textbf{ 194} of file \textbf{ yin.\+c}.



References \textbf{ yin\+\_\+s\+::diff\+\_\+window}, \textbf{ yin\+\_\+s\+::nfr}, \textbf{ yin\+\_\+s\+::period\+\_\+window}, \textbf{ yin\+\_\+s\+::search\+\_\+threshold}, \textbf{ yin\+\_\+s\+::wsize}, and \textbf{ yin\+\_\+s\+::wstart}.

