\doxysection{src/libsphinxbase/fe/yin.c File Reference}
\label{yin_8c}\index{src/libsphinxbase/fe/yin.c@{src/libsphinxbase/fe/yin.c}}


Implementation of pitch extraction.  


{\ttfamily \#include "{}sphinxbase/prim\+\_\+type.\+h"{}}\newline
{\ttfamily \#include "{}sphinxbase/ckd\+\_\+alloc.\+h"{}}\newline
{\ttfamily \#include "{}sphinxbase/fixpoint.\+h"{}}\newline
{\ttfamily \#include "{}sphinxbase/yin.\+h"{}}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
\doxysubsubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \textbf{ yin\+\_\+s}
\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\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 
void \textbf{ yin\+\_\+free} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Free a moving-\/window pitch estimator. \end{DoxyCompactList}\item 
void \textbf{ yin\+\_\+start} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Start processing an utterance. \end{DoxyCompactList}\item 
void \textbf{ yin\+\_\+end} (\textbf{ yin\+\_\+t} $\ast$pe)
\begin{DoxyCompactList}\small\item\em Mark the end of an utterance. \end{DoxyCompactList}\item 
int \textbf{ thresholded\+\_\+search} (int32 $\ast$diff\+\_\+window, fixed32 threshold, int start, int end)
\item 
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 
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 extraction. 

\begin{DoxyAuthor}{Author}
David Huggins-\/\+Daines {\texttt{ dhuggins@cs.\+cmu.\+edu}} 
\end{DoxyAuthor}


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



\doxysubsection{Function Documentation}
\label{yin_8c_a3befedc0027bb60c5c4b571a6a5c2e03} 
\index{yin.c@{yin.c}!thresholded\_search@{thresholded\_search}}
\index{thresholded\_search@{thresholded\_search}!yin.c@{yin.c}}
\doxysubsubsection{thresholded\_search()}
{\footnotesize\ttfamily int thresholded\+\_\+search (\begin{DoxyParamCaption}\item[{int32 $\ast$}]{diff\+\_\+window,  }\item[{fixed32}]{threshold,  }\item[{int}]{start,  }\item[{int}]{end }\end{DoxyParamCaption})}



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

\label{yin_8c_abfe51d8b596f85941831b2727e49c181} 
\index{yin.c@{yin.c}!yin\_end@{yin\_end}}
\index{yin\_end@{yin\_end}!yin.c@{yin.c}}
\doxysubsubsection{yin\_end()}
{\footnotesize\ttfamily 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_8c_a98f2ed13316b8ab9bf93feb4b6d3e7bd} 
\index{yin.c@{yin.c}!yin\_free@{yin\_free}}
\index{yin\_free@{yin\_free}!yin.c@{yin.c}}
\doxysubsubsection{yin\_free()}
{\footnotesize\ttfamily 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_8c_ad3a4297a7bd812f5bf18c0b1fff6b50f} 
\index{yin.c@{yin.c}!yin\_init@{yin\_init}}
\index{yin\_init@{yin\_init}!yin.c@{yin.c}}
\doxysubsubsection{yin\_init()}
{\footnotesize\ttfamily \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_8c_a5d4ceba1aed1fcc8e10f6408a271b294} 
\index{yin.c@{yin.c}!yin\_read@{yin\_read}}
\index{yin\_read@{yin\_read}!yin.c@{yin.c}}
\doxysubsubsection{yin\_read()}
{\footnotesize\ttfamily 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_8c_aedb765d2c9f8f9d96f90b4971ed0f649} 
\index{yin.c@{yin.c}!yin\_start@{yin\_start}}
\index{yin\_start@{yin\_start}!yin.c@{yin.c}}
\doxysubsubsection{yin\_start()}
{\footnotesize\ttfamily 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_8c_ae272b1d9ce8ad45f69eb8b5f98f305b6} 
\index{yin.c@{yin.c}!yin\_write@{yin\_write}}
\index{yin\_write@{yin\_write}!yin.c@{yin.c}}
\doxysubsubsection{yin\_write()}
{\footnotesize\ttfamily 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}.

