\section{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
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{yin_8h_a69a22f00f601c099b232e01b94704c2c}} 
typedef struct \textbf{ yin\+\_\+s} \textbf{ yin\+\_\+t}
\begin{DoxyCompactList}\small\item\em Frame-\/based moving-\/window pitch estimator. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\label{yin_8h_afc3a955f8d2215ed3d660737643c4f32}} 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT \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 
\mbox{\label{yin_8h_ae587e0d984966c482f21ee4cb0952dd0}} 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void \textbf{ yin\+\_\+free} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Free a moving-\/window pitch estimator. \end{DoxyCompactList}\item 
\mbox{\label{yin_8h_a9a93d7c0fd3eb97d8ea735a76683ff4d}} 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void \textbf{ yin\+\_\+start} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Start processing an utterance. \end{DoxyCompactList}\item 
\mbox{\label{yin_8h_a9182cabf44e517c2db3b67edacebece9}} 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT void \textbf{ yin\+\_\+end} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Mark the end of an utterance. \end{DoxyCompactList}\item 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT 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 
S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT 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}


\subsection{Detailed Description}
Implementation of pitch estimation. 

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

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

\subsection{Function Documentation}
\mbox{\label{yin_8h_a3a0ae5d5a543b9e71b34c9b4a285bdbf}} 
\index{yin.\+h@{yin.\+h}!yin\+\_\+read@{yin\+\_\+read}}
\index{yin\+\_\+read@{yin\+\_\+read}!yin.\+h@{yin.\+h}}
\subsubsection{yin\+\_\+read()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT 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 221 of file yin.\+c.



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

\mbox{\label{yin_8h_ac316a9b80593ad996df71b0f6df54d6c}} 
\index{yin.\+h@{yin.\+h}!yin\+\_\+write@{yin\+\_\+write}}
\index{yin\+\_\+write@{yin\+\_\+write}!yin.\+h@{yin.\+h}}
\subsubsection{yin\+\_\+write()}
{\footnotesize\ttfamily S\+P\+H\+I\+N\+X\+B\+A\+S\+E\+\_\+\+E\+X\+P\+O\+RT 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_afc3a955f8d2215ed3d660737643c4f32}) samples of audio data. \\
\hline
\end{DoxyParams}


Definition at line 194 of file yin.\+c.



References yin\+\_\+s\+::wsize, and yin\+\_\+s\+::wstart.

