1 /* 2 Copyright (C) 2003-2017 Paul Brossier <piem@aubio.org> 3 4 This file is part of aubio. 5 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/>. 18 19 */ 20 21 /** \file 22 23 Pitch detection using YIN algorithm (fast implementation) 24 25 This algorithm was developed by A. de Cheveigne and H. Kawahara and 26 published in: 27 28 De Cheveigné, A., Kawahara, H. (2002) "YIN, a fundamental frequency 29 estimator for speech and music", J. Acoust. Soc. Am. 111, 1917-1930. 30 31 This implementation compute the autocorrelation function using time domain 32 convolution computed in the spectral domain. 33 34 see http://recherche.ircam.fr/equipes/pcm/pub/people/cheveign.html 35 http://recherche.ircam.fr/equipes/pcm/cheveign/ps/2002_JASA_YIN_proof.pdf 36 37 */ 38 39 #ifndef AUBIO_PITCHYINFAST_H 40 #define AUBIO_PITCHYINFAST_H 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /** pitch detection object */ 47 typedef struct _aubio_pitchyinfast_t aubio_pitchyinfast_t; 48 49 /** creation of the pitch detection object 50 51 \param buf_size size of the input buffer to analyse 52 53 */ 54 aubio_pitchyinfast_t *new_aubio_pitchyinfast (uint_t buf_size); 55 56 /** deletion of the pitch detection object 57 58 \param o pitch detection object as returned by new_aubio_pitchyin() 59 60 */ 61 void del_aubio_pitchyinfast (aubio_pitchyinfast_t * o); 62 63 /** execute pitch detection an input buffer 64 65 \param o pitch detection object as returned by new_aubio_pitchyin() 66 \param samples_in input signal vector (length as specified at creation time) 67 \param cands_out pitch period candidates, in samples 68 69 */ 70 void aubio_pitchyinfast_do (aubio_pitchyinfast_t * o, const fvec_t * samples_in, fvec_t * cands_out); 71 72 73 /** set tolerance parameter for YIN algorithm 74 75 \param o YIN pitch detection object 76 \param tol tolerance parameter for minima selection [default 0.15] 77 78 */ 79 uint_t aubio_pitchyinfast_set_tolerance (aubio_pitchyinfast_t * o, smpl_t tol); 80 81 /** get tolerance parameter for YIN algorithm 82 83 \param o YIN pitch detection object 84 \return tolerance parameter for minima selection [default 0.15] 85 86 */ 87 smpl_t aubio_pitchyinfast_get_tolerance (aubio_pitchyinfast_t * o); 88 89 /** get current confidence of YIN algorithm 90 91 \param o YIN pitch detection object 92 \return confidence parameter 93 94 */ 95 smpl_t aubio_pitchyinfast_get_confidence (aubio_pitchyinfast_t * o); 96 97 #ifdef __cplusplus 98 } 99 #endif 100 101 #endif /* AUBIO_PITCHYINFAST_H */ 102 103