2 Copyright (C) 2013 Paul Brossier <piem@aubio.org>
4 This file is part of aubio.
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.
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.
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/>.
23 Pitch detection using spectral auto correlation
25 This algorithm implements pitch detection by computing the autocorrelation
26 function as the cosine transform of the square spectral magnitudes.
28 Anssi Klapuri. Qualitative and quantitative aspects in the design of
29 periodicity esti- mation algorithms. In Proceedings of the European Signal
30 Processing Conference (EUSIPCO), 2000.
32 Paul Brossier, [Automatic annotation of musical audio for interactive
33 systems](http://aubio.org/phd/), Chapter 3, Pitch Analysis, Autocorrelation,
34 pp. 75-77, PhD thesis, Centre for Digital music, Queen Mary University of
35 London, London, UK, 2006.
37 \example pitch/test-pitchspecacf.c
41 #ifndef AUBIO_PITCHSPECACF_H
42 #define AUBIO_PITCHSPECACF_H
48 /** pitch detection object */
49 typedef struct _aubio_pitchspecacf_t aubio_pitchspecacf_t;
51 /** execute pitch detection on an input buffer
53 \param o pitch detection object as returned by new_aubio_pitchspecacf
54 \param samples_in input signal vector (length as specified at creation time)
55 \param cands_out pitch period candidates, in samples
58 void aubio_pitchspecacf_do (aubio_pitchspecacf_t * o, fvec_t * samples_in, fvec_t * cands_out);
59 /** creation of the pitch detection object
61 \param buf_size size of the input buffer to analyse
64 aubio_pitchspecacf_t *new_aubio_pitchspecacf (uint_t buf_size);
65 /** deletion of the pitch detection object
67 \param o pitch detection object as returned by new_aubio_pitchspecacf()
70 void del_aubio_pitchspecacf (aubio_pitchspecacf_t * o);
72 /** get tolerance parameter for `specacf` pitch detection object
74 \param o pitch detection object
76 \return tolerance parameter for minima selection [default 1.]
79 smpl_t aubio_pitchspecacf_get_tolerance (aubio_pitchspecacf_t * o);
81 /** set tolerance parameter for `specacf` pitch detection object
83 \param o pitch detection object
84 \param tol tolerance parameter for minima selection [default 1.]
86 \return `1` on error, `0` on success
89 uint_t aubio_pitchspecacf_set_tolerance (aubio_pitchspecacf_t * o, smpl_t tol);
91 /** get currenct confidence for `specacf` pitch detection object
93 \param o pitch detection object
94 \return confidence parameter
97 smpl_t aubio_pitchspecacf_get_confidence (aubio_pitchspecacf_t * o);
103 #endif /*AUBIO_PITCHSPECACF_H*/