1 | /* |
---|
2 | Copyright (C) 2003-2015 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 a spectral implementation of the YIN algorithm |
---|
24 | |
---|
25 | This algorithm was derived from the YIN algorithm. In this implementation, a |
---|
26 | Fourier transform is used to compute a tapered square difference function, |
---|
27 | which allows spectral weighting. Because the difference function is tapered, |
---|
28 | the selection of the period is simplified. |
---|
29 | |
---|
30 | Paul Brossier, [Automatic annotation of musical audio for interactive |
---|
31 | systems](http://aubio.org/phd/), Chapter 3, Pitch Analysis, PhD thesis, |
---|
32 | Centre for Digital music, Queen Mary University of London, London, UK, 2006. |
---|
33 | |
---|
34 | \example pitch/test-pitchyinfft.c |
---|
35 | |
---|
36 | */ |
---|
37 | |
---|
38 | #ifndef AUBIO_PITCHYINFFT_H |
---|
39 | #define AUBIO_PITCHYINFFT_H |
---|
40 | |
---|
41 | #ifdef __cplusplus |
---|
42 | extern "C" { |
---|
43 | #endif |
---|
44 | |
---|
45 | /** pitch detection object */ |
---|
46 | typedef struct _aubio_pitchyinfft_t aubio_pitchyinfft_t; |
---|
47 | |
---|
48 | /** execute pitch detection on an input buffer |
---|
49 | |
---|
50 | \param o pitch detection object as returned by new_aubio_pitchyinfft |
---|
51 | \param samples_in input signal vector (length as specified at creation time) |
---|
52 | \param cands_out pitch period candidates, in samples |
---|
53 | |
---|
54 | */ |
---|
55 | void aubio_pitchyinfft_do (aubio_pitchyinfft_t * o, const fvec_t * samples_in, fvec_t * cands_out); |
---|
56 | /** creation of the pitch detection object |
---|
57 | |
---|
58 | \param samplerate samplerate of the input signal |
---|
59 | \param buf_size size of the input buffer to analyse |
---|
60 | |
---|
61 | */ |
---|
62 | aubio_pitchyinfft_t *new_aubio_pitchyinfft (uint_t samplerate, uint_t buf_size); |
---|
63 | /** deletion of the pitch detection object |
---|
64 | |
---|
65 | \param o pitch detection object as returned by new_aubio_pitchyinfft() |
---|
66 | |
---|
67 | */ |
---|
68 | void del_aubio_pitchyinfft (aubio_pitchyinfft_t * o); |
---|
69 | |
---|
70 | /** get tolerance parameter for YIN algorithm |
---|
71 | |
---|
72 | \param o YIN pitch detection object |
---|
73 | |
---|
74 | \return tolerance parameter for minima selection [default 0.15] |
---|
75 | |
---|
76 | */ |
---|
77 | smpl_t aubio_pitchyinfft_get_tolerance (aubio_pitchyinfft_t * o); |
---|
78 | |
---|
79 | /** set tolerance parameter for YIN algorithm |
---|
80 | |
---|
81 | \param o YIN pitch detection object |
---|
82 | \param tol tolerance parameter for minima selection [default 0.15] |
---|
83 | |
---|
84 | */ |
---|
85 | uint_t aubio_pitchyinfft_set_tolerance (aubio_pitchyinfft_t * o, smpl_t tol); |
---|
86 | |
---|
87 | /** get current confidence of YIN algorithm |
---|
88 | |
---|
89 | \param o YIN pitch detection object |
---|
90 | \return confidence parameter |
---|
91 | |
---|
92 | */ |
---|
93 | smpl_t aubio_pitchyinfft_get_confidence (aubio_pitchyinfft_t * o); |
---|
94 | |
---|
95 | #ifdef __cplusplus |
---|
96 | } |
---|
97 | #endif |
---|
98 | |
---|
99 | #endif /* AUBIO_PITCHYINFFT_H */ |
---|