\section{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 \char`\"{}sphinxbase/prim\+\_\+type.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}sphinxbase/ckd\+\_\+alloc.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}sphinxbase/fixpoint.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}sphinxbase/yin.\+h\char`\"{}}\\*
{\ttfamily \#include $<$stdio.\+h$>$}\\*
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct {\bf yin\+\_\+s}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
{\bf yin\+\_\+t} $\ast$ {\bf yin\+\_\+init} (int frame\+\_\+size, float search\+\_\+threshold, float search\+\_\+range, int smooth\+\_\+window)\label{yin_8c_adeaf7df902787daf9fa9d7453798c01e}

\begin{DoxyCompactList}\small\item\em Initialize moving-\/window pitch estimation. \end{DoxyCompactList}\item 
void {\bf yin\+\_\+free} ({\bf yin\+\_\+t} $\ast$pe)\label{yin_8c_a98f2ed13316b8ab9bf93feb4b6d3e7bd}

\begin{DoxyCompactList}\small\item\em Free a moving-\/window pitch estimator. \end{DoxyCompactList}\item 
void {\bf yin\+\_\+start} ({\bf yin\+\_\+t} $\ast$pe)\label{yin_8c_aedb765d2c9f8f9d96f90b4971ed0f649}

\begin{DoxyCompactList}\small\item\em Start processing an utterance. \end{DoxyCompactList}\item 
void {\bf yin\+\_\+end} ({\bf yin\+\_\+t} $\ast$pe)\label{yin_8c_abfe51d8b596f85941831b2727e49c181}

\begin{DoxyCompactList}\small\item\em Mark the end of an utterance. \end{DoxyCompactList}\item 
int {\bfseries thresholded\+\_\+search} (int32 $\ast$diff\+\_\+window, fixed32 threshold, int start, int end)\label{yin_8c_a3befedc0027bb60c5c4b571a6a5c2e03}

\item 
void {\bf yin\+\_\+write} ({\bf 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 {\bf yin\+\_\+read} ({\bf 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 extraction. 

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


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



\subsection{Function Documentation}
\index{yin.\+c@{yin.\+c}!yin\+\_\+read@{yin\+\_\+read}}
\index{yin\+\_\+read@{yin\+\_\+read}!yin.\+c@{yin.\+c}}
\subsubsection[{yin\+\_\+read}]{\setlength{\rightskip}{0pt plus 5cm}int yin\+\_\+read (
\begin{DoxyParamCaption}
\item[{{\bf yin\+\_\+t} $\ast$}]{pe, }
\item[{uint16 $\ast$}]{out\+\_\+period, }
\item[{uint16 $\ast$}]{out\+\_\+bestdiff}
\end{DoxyParamCaption}
)}\label{yin_8c_a5d4ceba1aed1fcc8e10f6408a271b294}


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\+::search\+\_\+threshold, yin\+\_\+s\+::wcur, yin\+\_\+s\+::wsize, and yin\+\_\+s\+::wstart.

\index{yin.\+c@{yin.\+c}!yin\+\_\+write@{yin\+\_\+write}}
\index{yin\+\_\+write@{yin\+\_\+write}!yin.\+c@{yin.\+c}}
\subsubsection[{yin\+\_\+write}]{\setlength{\rightskip}{0pt plus 5cm}void yin\+\_\+write (
\begin{DoxyParamCaption}
\item[{{\bf yin\+\_\+t} $\ast$}]{pe, }
\item[{int16 const $\ast$}]{frame}
\end{DoxyParamCaption}
)}\label{yin_8c_ae272b1d9ce8ad45f69eb8b5f98f305b6}


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\+::diff\+\_\+window, yin\+\_\+s\+::nfr, yin\+\_\+s\+::period\+\_\+window, yin\+\_\+s\+::search\+\_\+threshold, yin\+\_\+s\+::wsize, and yin\+\_\+s\+::wstart.

