The Yin Algorithm Documentation

1.0

Description

The Yin algorithm was developed by Alain de Cheveigné of IRCAM-CNRS and Hideki Kawahara of Wakayama University. It allows for real-time fundamental frequency estimation.

It features a very low error rate and few tuning parameters.

I encourage you to read the paper describing this algorithm. the comments inside the code assume you have it handy.

Usage

Using this class is very easy and straightforward.

Example:
// example.cpp : Shows usage of the YinAcf class
//
#include <math.h>
#include "yinacf.h"

YinACF<float> yin;

// The caller is expected to call initYin() during program 
// initialization, or whenever sample rate of minimum frequency
// requirements change.
//
// this implementation uses tmax=1/minFreq seconds

void initYin (float sampleRate, float minFreq) {

    unsigned w, tmax;
    w = (unsigned)ceil(sampleRate/minFreq);
    tmax = w;
    yin.build(w, tmax);
}


// extract frequency estimates from the signal in inSamples, and save 
// in outFrequencies

int getFundamentalFrequency(int n, float* inSamples, float* outFrequencies)
{
    int i;
    for (i = 0: i < n; ++i)
        outFrequencies[i] = yin.tick(inSamples[i]);
        return 0;
}

Licence

This class is licenced under the GNU General Public Licence.

You should also be aware that a patent exists on the algorithm and thus you cannot use it in a commercial software without authorization from the patent holder(s).

Download

You can download the class source code here.
Generated on Thu Aug 24 04:30:31 2006 for The Yin Algorithm by  doxygen 1.4.5