From: Paul Brossier Date: Wed, 17 May 2006 18:16:59 +0000 (+0000) Subject: update pitch method comments X-Git-Tag: bzr2git~694 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7f3ccc5e83ab732b4d7b7c3766f25571caff1f8e;p=aubio.git update pitch method comments update pitch method comments --- diff --git a/src/pitchfcomb.c b/src/pitchfcomb.c index f9e37ee7..db72b0e9 100644 --- a/src/pitchfcomb.c +++ b/src/pitchfcomb.c @@ -17,16 +17,6 @@ */ -/* - - This file was taken from the tuneit project, in the file - tuneit.c -- Detect fundamental frequency of a sound - see http://delysid.org/tuneit.html - - a fast harmonic comb filter algorithm for pitch tracking - -*/ - #include "aubio_priv.h" #include "sample.h" #include "mathutils.h" diff --git a/src/pitchfcomb.h b/src/pitchfcomb.h index c3118d0d..1f1974b5 100644 --- a/src/pitchfcomb.h +++ b/src/pitchfcomb.h @@ -17,6 +17,20 @@ */ +/** \file + + Pitch detection using a fast harmonic comb filter + + This pitch extraction method implements a fast harmonic comb filter to + determine the fundamental frequency of a harmonic sound. + + This file was derived from the tuneit project, written by Mario Lang to + detect the fundamental frequency of a sound. + + see http://delysid.org/tuneit.html + +*/ + #ifndef _PITCHFCOMB_H #define _PITCHFCOMB_H @@ -24,10 +38,29 @@ extern "C" { #endif +/** pitch detection object */ typedef struct _aubio_pitchfcomb_t aubio_pitchfcomb_t; +/** execute pitch detection on an input buffer + + \param p pitch detection object as returned by new_aubio_pitchfcomb + \param input input signal window (length as specified at creation time) + +*/ smpl_t aubio_pitchfcomb_detect (aubio_pitchfcomb_t *p, fvec_t * input); +/** creation of the pitch detection object + + \param bufsize size of the input buffer to analyse + \param hopsize step size between two consecutive analysis instant + \param samplerate sampling rate of the signal + +*/ aubio_pitchfcomb_t * new_aubio_pitchfcomb (uint_t bufsize, uint_t hopsize, uint_t samplerate); +/** deletion of the pitch detection object + + \param p pitch detection object as returned by new_aubio_pitchfcomb + +*/ void del_aubio_pitchfcomb (aubio_pitchfcomb_t *p); diff --git a/src/pitchmcomb.c b/src/pitchmcomb.c index 2b5fe20f..50ae0291 100644 --- a/src/pitchmcomb.c +++ b/src/pitchmcomb.c @@ -160,7 +160,7 @@ void aubio_pitchmcomb_spectral_pp(aubio_pitchmcomb_t * p, fvec_t * newmag) { vec_dc_removal(mag); /* dc removal */ vec_alpha_normalise(mag,p->alpha); /* alpha normalisation */ /* skipped */ /* low pass filtering */ - /** \bug: vec_movind_thres writes out of bounds */ + /** \bug vec_moving_thres may write out of bounds */ vec_adapt_thres(mag,tmp,p->win_post,p->win_pre); /* adaptative threshold */ vec_add(mag,-p->threshold); /* fixed threshold */ { @@ -324,7 +324,7 @@ void aubio_pitchmcomb_sort_cand_freq(aubio_spectralcandidate_t ** candidates, ui aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate) { aubio_pitchmcomb_t * p = AUBIO_NEW(aubio_pitchmcomb_t); - /** \bug should check if size / 8 > post+pre+1 */ + /* bug: should check if size / 8 > post+pre+1 */ uint_t i; uint_t spec_size; p->spec_partition = 4; diff --git a/src/pitchmcomb.h b/src/pitchmcomb.h index d730d0ff..eea65647 100644 --- a/src/pitchmcomb.h +++ b/src/pitchmcomb.h @@ -18,10 +18,19 @@ */ /** \file - * spectral pitch detection function - * - * \todo check/fix peak picking - */ + + Pitch detection using multiple-comb filter + + This fundamental frequency estimation algorithm implements spectral + flattening, multi-comb filtering and peak histogramming. + + This method was designed by Juan P. Bello and described in: + + Juan-Pablo Bello. ``Towards the Automated Analysis of Simple Polyphonic + Music''. PhD thesis, Centre for Digital Music, Queen Mary University of + London, London, UK, 2003. + +*/ #ifndef PITCHMCOMB_H #define PITCHMCOMB_H @@ -30,11 +39,31 @@ extern "C" { #endif +/** pitch detection object */ typedef struct _aubio_pitchmcomb_t aubio_pitchmcomb_t; +/** execute pitch detection on an input spectral frame + + \param p pitch detection object as returned by new_aubio_pitchmcomb + \param fftgrain input signal spectrum as computed by aubio_pvoc_do + +*/ smpl_t aubio_pitchmcomb_detect(aubio_pitchmcomb_t * p, cvec_t * fftgrain); uint_t aubio_pitch_cands(aubio_pitchmcomb_t * p, cvec_t * fftgrain, smpl_t * cands); +/** creation of the pitch detection object + + \param bufsize size of the input buffer to analyse + \param hopsize step size between two consecutive analysis instant + \param channels number of channels to analyse + \param samplerate sampling rate of the signal + +*/ aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate); +/** deletion of the pitch detection object + + \param p pitch detection object as returned by new_aubio_pitchfcomb + +*/ void del_aubio_pitchmcomb(aubio_pitchmcomb_t *p); #ifdef __cplusplus diff --git a/src/pitchyin.h b/src/pitchyin.h index b21c0bfe..3123b6f3 100644 --- a/src/pitchyin.h +++ b/src/pitchyin.h @@ -16,14 +16,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* This algorithm was developped by A. de Cheveigne and H. Kawahara and - * published in: - * - * de Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency - * estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930. - * - * see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html - */ +/** \file + + Pitch detection using the YIN algorithm + + This algorithm was developped by A. de Cheveigne and H. Kawahara and + published in: + + De Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency + estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930. + + see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html + +*/ #ifndef PITCHYIN_H #define PITCHYIN_H @@ -32,12 +37,35 @@ extern "C" { #endif +/** compute difference function + + \param input input signal + \param yinbuf output buffer to store difference function (half shorter than input) + +*/ void aubio_pitchyin_diff(fvec_t * input, fvec_t * yinbuf); +/** in place computation of the YIN cumulative normalised function + + \param yinbuf input signal (a square difference function), also used to store function + +*/ void aubio_pitchyin_getcum(fvec_t * yinbuf); +/** detect pitch in a YIN function + + \param yinbuf input buffer as computed by aubio_pitchyin_getcum + +*/ uint_t aubio_pitchyin_getpitch(fvec_t *yinbuf); +/** fast implementation of the YIN algorithm + + \param input input signal + \param yinbuf input buffer used to compute the YIN function + \param tol tolerance parameter for minima selection [default 0.15] + +*/ smpl_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t *yinbuf, smpl_t tol); #ifdef __cplusplus diff --git a/src/pitchyinfft.c b/src/pitchyinfft.c index 45cf83da..ed1b32f6 100644 --- a/src/pitchyinfft.c +++ b/src/pitchyinfft.c @@ -16,19 +16,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* This algorithm was developped by A. de Cheveigne and H. Kawahara and - * published in: - * - * de Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency - * estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930. - * - * see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html - * - * This implementation is using an FFT to compute the square difference - * function, which allows spectral weighting - * - */ - #include "aubio_priv.h" #include "sample.h" #include "mathutils.h" @@ -138,7 +125,7 @@ smpl_t aubio_pitchyinfft_detect(aubio_pitchyinfft_t * p, fvec_t * input, smpl_t //return tau+2; /* 3 point quadratic interpolation */ //return vec_quadint_min(yin,tau,1); - /* additional check nlikely octave doubling in higher frequencies */ + /* additional check for (unlikely) octave doubling in higher frequencies */ if (tau>35) { return vec_quadint_min(yin,tau,1)+1; } else { diff --git a/src/pitchyinfft.h b/src/pitchyinfft.h index 11161fd9..7bf6b753 100644 --- a/src/pitchyinfft.h +++ b/src/pitchyinfft.h @@ -16,14 +16,20 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* This algorithm was developped by A. de Cheveigne and H. Kawahara and - * published in: - * - * de Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency - * estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930. - * - * see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html - */ +/** \file + + Pitch detection using a spectral implementation of the YIN algorithm + + This algorithm was derived from the YIN algorithm (see pitchyin.c). In this + implementation, a Fourier transform is used to compute a tapered square + difference function, which allows spectral weighting. Because the difference + function is tapered, the selection of the period is simplified. + + Paul Brossier, ``Automatic annotation of musical audio for interactive + systems'', Chapter 3, Pitch Analysis, PhD thesis, Centre for Digital music, + Queen Mary University of London, London, UK, 2003. + +*/ #ifndef PITCHYINFFT_H #define PITCHYINFFT_H @@ -32,9 +38,22 @@ extern "C" { #endif +/** pitch detection object */ typedef struct _aubio_pitchyinfft_t aubio_pitchyinfft_t; +/** execute pitch detection on an input buffer + + \param p pitch detection object as returned by new_aubio_pitchyinfft + \param input input signal window (length as specified at creation time) + \param tol tolerance parameter for minima selection [default 0.85] + +*/ smpl_t aubio_pitchyinfft_detect (aubio_pitchyinfft_t *p, fvec_t * input, smpl_t tol); +/** creation of the pitch detection object + + \param bufsize size of the input buffer to analyse + +*/ aubio_pitchyinfft_t * new_aubio_pitchyinfft (uint_t bufsize); void del_aubio_pitchyinfft (aubio_pitchyinfft_t *p);