[96fb8ad] | 1 | /* |
---|
[b235c0e] | 2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
---|
[96fb8ad] | 3 | |
---|
[e6a78ea] | 4 | This file is part of aubio. |
---|
[96fb8ad] | 5 | |
---|
[e6a78ea] | 6 | aubio is free software: you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation, either version 3 of the License, or |
---|
| 9 | (at your option) any later version. |
---|
| 10 | |
---|
| 11 | aubio is distributed in the hope that it will be useful, |
---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | GNU General Public License for more details. |
---|
| 15 | |
---|
| 16 | You should have received a copy of the GNU General Public License |
---|
| 17 | along with aubio. If not, see <http://www.gnu.org/licenses/>. |
---|
[96fb8ad] | 18 | |
---|
| 19 | */ |
---|
| 20 | |
---|
[69b11d8] | 21 | /** \file |
---|
| 22 | |
---|
[7f3ccc5e] | 23 | Pitch detection using the YIN algorithm |
---|
[69b11d8] | 24 | |
---|
[7f0fd1d] | 25 | This algorithm was developed by A. de Cheveigne and H. Kawahara and |
---|
[7f3ccc5e] | 26 | published in: |
---|
[69b11d8] | 27 | |
---|
[7f3ccc5e] | 28 | De Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency |
---|
[69b11d8] | 29 | estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930. |
---|
| 30 | |
---|
[7f3ccc5e] | 31 | see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html |
---|
[30fb06f] | 32 | http://recherche.ircam.fr/equipes/pcm/cheveign/ps/2002_JASA_YIN_proof.pdf |
---|
[7f3ccc5e] | 33 | |
---|
[fbc5544] | 34 | \example pitch/test-pitchyin.c |
---|
| 35 | |
---|
[7f3ccc5e] | 36 | */ |
---|
[96fb8ad] | 37 | |
---|
[6f42c16] | 38 | #ifndef AUBIO_PITCHYIN_H |
---|
| 39 | #define AUBIO_PITCHYIN_H |
---|
[96fb8ad] | 40 | |
---|
| 41 | #ifdef __cplusplus |
---|
| 42 | extern "C" { |
---|
| 43 | #endif |
---|
| 44 | |
---|
[2ba3440] | 45 | /** pitch detection object */ |
---|
| 46 | typedef struct _aubio_pitchyin_t aubio_pitchyin_t; |
---|
[7f3ccc5e] | 47 | |
---|
[2ba3440] | 48 | /** creation of the pitch detection object |
---|
[69b11d8] | 49 | |
---|
| 50 | \param buf_size size of the input buffer to analyse |
---|
| 51 | |
---|
[7f3ccc5e] | 52 | */ |
---|
[3ac7cb0] | 53 | aubio_pitchyin_t *new_aubio_pitchyin (uint_t buf_size); |
---|
[96fb8ad] | 54 | |
---|
[2ba3440] | 55 | /** deletion of the pitch detection object |
---|
[69b11d8] | 56 | |
---|
| 57 | \param o pitch detection object as returned by new_aubio_pitchyin() |
---|
| 58 | |
---|
[2ba3440] | 59 | */ |
---|
| 60 | void del_aubio_pitchyin (aubio_pitchyin_t * o); |
---|
[7f3ccc5e] | 61 | |
---|
[69b11d8] | 62 | /** execute pitch detection an input buffer |
---|
| 63 | |
---|
| 64 | \param o pitch detection object as returned by new_aubio_pitchyin() |
---|
| 65 | \param samples_in input signal vector (length as specified at creation time) |
---|
| 66 | \param cands_out pitch period candidates, in samples |
---|
| 67 | |
---|
[7f3ccc5e] | 68 | */ |
---|
[ce3ff2b] | 69 | void aubio_pitchyin_do (aubio_pitchyin_t * o, const fvec_t * samples_in, fvec_t * cands_out); |
---|
[69b11d8] | 70 | |
---|
[96fb8ad] | 71 | |
---|
[69b11d8] | 72 | /** set tolerance parameter for YIN algorithm |
---|
[2ba3440] | 73 | |
---|
[69b11d8] | 74 | \param o YIN pitch detection object |
---|
[2ba3440] | 75 | \param tol tolerance parameter for minima selection [default 0.15] |
---|
[7f3ccc5e] | 76 | |
---|
| 77 | */ |
---|
[fddfa64] | 78 | uint_t aubio_pitchyin_set_tolerance (aubio_pitchyin_t * o, smpl_t tol); |
---|
[96fb8ad] | 79 | |
---|
[69b11d8] | 80 | /** get tolerance parameter for YIN algorithm |
---|
| 81 | |
---|
| 82 | \param o YIN pitch detection object |
---|
[2ba3440] | 83 | \return tolerance parameter for minima selection [default 0.15] |
---|
[7f3ccc5e] | 84 | |
---|
| 85 | */ |
---|
[d9b5009] | 86 | smpl_t aubio_pitchyin_get_tolerance (aubio_pitchyin_t * o); |
---|
[33bf500] | 87 | |
---|
[5284e0d] | 88 | /** get current confidence of YIN algorithm |
---|
| 89 | |
---|
| 90 | \param o YIN pitch detection object |
---|
| 91 | \return confidence parameter |
---|
| 92 | |
---|
| 93 | */ |
---|
| 94 | smpl_t aubio_pitchyin_get_confidence (aubio_pitchyin_t * o); |
---|
| 95 | |
---|
[96fb8ad] | 96 | #ifdef __cplusplus |
---|
| 97 | } |
---|
| 98 | #endif |
---|
| 99 | |
---|
[6f42c16] | 100 | #endif /* AUBIO_PITCHYIN_H */ |
---|