1 | /* |
---|
2 | Copyright (C) 2013 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 spectral auto correlation |
---|
24 | |
---|
25 | This algorithm implements pitch detection by computing the autocorrelation |
---|
26 | function as the cosine transform of the square spectral magnitudes. |
---|
27 | |
---|
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. |
---|
31 | |
---|
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. |
---|
36 | |
---|
37 | \example pitch/test-pitchspecacf.c |
---|
38 | |
---|
39 | */ |
---|
40 | |
---|
41 | #ifndef AUBIO_PITCHSPECACF_H |
---|
42 | #define AUBIO_PITCHSPECACF_H |
---|
43 | |
---|
44 | #ifdef __cplusplus |
---|
45 | extern "C" { |
---|
46 | #endif |
---|
47 | |
---|
48 | /** pitch detection object */ |
---|
49 | typedef struct _aubio_pitchspecacf_t aubio_pitchspecacf_t; |
---|
50 | |
---|
51 | /** execute pitch detection on an input buffer |
---|
52 | |
---|
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 |
---|
56 | |
---|
57 | */ |
---|
58 | void aubio_pitchspecacf_do (aubio_pitchspecacf_t * o, const fvec_t * samples_in, fvec_t * cands_out); |
---|
59 | /** creation of the pitch detection object |
---|
60 | |
---|
61 | \param buf_size size of the input buffer to analyse |
---|
62 | |
---|
63 | */ |
---|
64 | aubio_pitchspecacf_t *new_aubio_pitchspecacf (uint_t buf_size); |
---|
65 | /** deletion of the pitch detection object |
---|
66 | |
---|
67 | \param o pitch detection object as returned by new_aubio_pitchspecacf() |
---|
68 | |
---|
69 | */ |
---|
70 | void del_aubio_pitchspecacf (aubio_pitchspecacf_t * o); |
---|
71 | |
---|
72 | /** get tolerance parameter for `specacf` pitch detection object |
---|
73 | |
---|
74 | \param o pitch detection object |
---|
75 | |
---|
76 | \return tolerance parameter for minima selection [default 1.] |
---|
77 | |
---|
78 | */ |
---|
79 | smpl_t aubio_pitchspecacf_get_tolerance (const aubio_pitchspecacf_t * o); |
---|
80 | |
---|
81 | /** set tolerance parameter for `specacf` pitch detection object |
---|
82 | |
---|
83 | \param o pitch detection object |
---|
84 | \param tol tolerance parameter for minima selection [default 1.] |
---|
85 | |
---|
86 | \return `1` on error, `0` on success |
---|
87 | |
---|
88 | */ |
---|
89 | uint_t aubio_pitchspecacf_set_tolerance (aubio_pitchspecacf_t * o, smpl_t tol); |
---|
90 | |
---|
91 | /** get currenct confidence for `specacf` pitch detection object |
---|
92 | |
---|
93 | \param o pitch detection object |
---|
94 | \return confidence parameter |
---|
95 | |
---|
96 | */ |
---|
97 | smpl_t aubio_pitchspecacf_get_confidence (const aubio_pitchspecacf_t * o); |
---|
98 | |
---|
99 | #ifdef __cplusplus |
---|
100 | } |
---|
101 | #endif |
---|
102 | |
---|
103 | #endif /* AUBIO_PITCHSPECACF_H */ |
---|