YinACF< Sample > Class Template Reference

#include <yinacf.h>

List of all members.


Detailed Description

template<class Sample>
class YinACF< Sample >

the Yin algorithm.

Complete Yin algorithm as described by A. de Cheveigne and H. Kawahara in YIN, a fundamental frequency estimator for speech and music, J. Acoust. Soc. Am. 111, 1917-1930.

According to the author, this algorithm works best with low-pass prefiltering at 1000 Hz, although it will function really well without.

This particular implementation will function in real time with sample rates of up to 20 kHz

Definition at line 57 of file yinacf.h.

Public Member Functions

 YinACF ()
 ~YinACF ()
bool build (unsigned windowSize, unsigned tmax)
void destroy ()
void reset ()
virtual Sample tick (const Sample &s)
unsigned getLatency () const
unsigned getWindowSize () const
const Sample * getDiff (int offset=0) const
const Sample * getCMNDiff (int offset=0) const
const getFrequency (int offset=0) const
Sample getThreshold () const
void setThreshold (const Sample &threshold)
unsigned getMaxPeriod () const


Constructor & Destructor Documentation

template<class Sample>
YinACF< Sample >::YinACF  )  [inline]
 

builds an uninitialized YinACF object.

Builds an uninitialized YinACF object. The object must be initialized by a call to build() before use.

See also:
build()

Definition at line 139 of file yinacf.h.

template<class Sample>
YinACF< Sample >::~YinACF  )  [inline]
 

destructor.

Destroys the YinACF object.

Definition at line 156 of file yinacf.h.


Member Function Documentation

template<class Sample>
bool YinACF< Sample >::build unsigned  windowSize,
unsigned  tmax
[inline]
 

initializes the object before use.

Initializes the YinACF object for use.

Parameters:
windowSize size of the autocorrelation window in samples. The window size determinates the minimum frequency that can be detected by the algorithm. This minimum frequency is calculated by the equation $f_{min}=\frac{f_s}{W}$ , where $W$ is the window size, and $f_s$ is the sampling rate.
tmax $T_{max}$ in samples, as described in paragraph 2.F of the original paper.
Returns:
always true.

Definition at line 177 of file yinacf.h.

template<class Sample>
void YinACF< Sample >::destroy  )  [inline]
 

frees memory.

Frees the memory allocated by build().

See also:
build()

Definition at line 206 of file yinacf.h.

template<class Sample>
const Sample* YinACF< Sample >::getCMNDiff int  offset = 0  )  const [inline]
 

returns a solution's cumulative mean difference function.

Returns a solution's cumulative mean difference function. This function is provided for debugging and visualiation of the cumulative mean difference function at a point in time.

Parameters:
offset time offset in samples, can vary between 0, for the last (current) sample fed to the algorithm to TMAX.
Returns:
the requested solution's cumulative mean difference function.

Definition at line 332 of file yinacf.h.

template<class Sample>
const Sample* YinACF< Sample >::getDiff int  offset = 0  )  const [inline]
 

returns a solution's difference function.

Returns a solution's difference function. This function is provided for debugging and visualiation of the difference function at a point in time.

Parameters:
offset time offset in samples, can vary between 0, for the last (current) sample fed to the algorithm to TMAX.
Returns:
the requested solution's difference function.

Definition at line 315 of file yinacf.h.

template<class Sample>
const YinACF< Sample >::getFrequency int  offset = 0  )  const [inline]
 

returns a solution's calculated frequency.

Returns a solution's calculated frequency. This function is provided for debugging and visualiation of the calculated frequency at a point in time.

Parameters:
offset time offset in samples, can vary between 0, for the last (current) sample fed to the algorithm to TMAX.
Returns:
the requested solution's calculated frequency.

Definition at line 349 of file yinacf.h.

template<class Sample>
unsigned YinACF< Sample >::getLatency  )  const [inline]
 

returns algorithm latency.

Returns the latency of the algorithm in samples.

See also:
tick()

Definition at line 286 of file yinacf.h.

template<class Sample>
unsigned YinACF< Sample >::getMaxPeriod  )  const [inline]
 

returns TMAX.

Returns TMAX.

Returns:
TMAX.

Definition at line 383 of file yinacf.h.

template<class Sample>
Sample YinACF< Sample >::getThreshold  )  const [inline]
 

returns the treshold used by getDip().

The threshold used by getDip(), its default value is 0.1.

Returns:
the treshold used by getDip().

Definition at line 361 of file yinacf.h.

template<class Sample>
unsigned YinACF< Sample >::getWindowSize  )  const [inline]
 

returns window size.

Returns the window size in samples.

See also:
build()

Definition at line 298 of file yinacf.h.

template<class Sample>
void YinACF< Sample >::reset  )  [inline]
 

clears buffers.

Clears all buffers to 0.

Definition at line 226 of file yinacf.h.

template<class Sample>
void YinACF< Sample >::setThreshold const Sample &  threshold  )  [inline]
 

changes the treshold used by getDip().

Modigfies the threshold used by getDip(), its default value is 0.1.

Definition at line 371 of file yinacf.h.

template<class Sample>
virtual Sample YinACF< Sample >::tick const Sample &  s  )  [inline, virtual]
 

processes sample.

Processes signal data.

Parameters:
s signal sample.
Returns:
frequency of the signal in normalized frequency range [0.. 0.5]. This frequency reading is delayed by the algorithm's latency.
See also:
getLatency()

Definition at line 260 of file yinacf.h.


The documentation for this class was generated from the following file:
Generated on Thu Aug 24 04:21:11 2006 for The Yin Algorithm by  doxygen 1.4.5