1 | /* |
---|
2 | Copyright (C) 2006-2009 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 | Tempo detection object |
---|
24 | |
---|
25 | This object stores all the memory required for tempo detection algorithm |
---|
26 | and returns the estimated beat locations. |
---|
27 | |
---|
28 | \example tempo/test-tempo.c |
---|
29 | |
---|
30 | */ |
---|
31 | |
---|
32 | #ifndef TEMPO_H |
---|
33 | #define TEMPO_H |
---|
34 | |
---|
35 | #ifdef __cplusplus |
---|
36 | extern "C" { |
---|
37 | #endif |
---|
38 | |
---|
39 | /** tempo detection structure */ |
---|
40 | typedef struct _aubio_tempo_t aubio_tempo_t; |
---|
41 | |
---|
42 | /** create tempo detection object |
---|
43 | |
---|
44 | \param buf_size length of FFT |
---|
45 | \param hop_size number of frames between two consecutive runs |
---|
46 | \param samplerate sampling rate of the signal to analyze |
---|
47 | |
---|
48 | \return newly created ::aubio_tempo_t if successful, `NULL` otherwise |
---|
49 | |
---|
50 | */ |
---|
51 | aubio_tempo_t * new_aubio_tempo (char_t * method, |
---|
52 | uint_t buf_size, uint_t hop_size, uint_t samplerate); |
---|
53 | |
---|
54 | /** execute tempo detection |
---|
55 | |
---|
56 | \param o beat tracking object |
---|
57 | \param input new samples |
---|
58 | \param tempo output beats |
---|
59 | |
---|
60 | */ |
---|
61 | void aubio_tempo_do (aubio_tempo_t *o, fvec_t * input, fvec_t * tempo); |
---|
62 | |
---|
63 | /** set tempo detection silence threshold |
---|
64 | |
---|
65 | \param o beat tracking object |
---|
66 | \param threshold new silence threshold, in dB |
---|
67 | |
---|
68 | \return `0` if successful, non-zero otherwise |
---|
69 | |
---|
70 | */ |
---|
71 | uint_t aubio_tempo_set_silence(aubio_tempo_t * o, smpl_t silence); |
---|
72 | |
---|
73 | /** set tempo detection peak picking threshold |
---|
74 | |
---|
75 | \param o beat tracking object |
---|
76 | \param threshold new threshold |
---|
77 | |
---|
78 | \return `0` if successful, non-zero otherwise |
---|
79 | |
---|
80 | */ |
---|
81 | uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold); |
---|
82 | |
---|
83 | /** get current tempo |
---|
84 | |
---|
85 | \param o beat tracking object |
---|
86 | |
---|
87 | \return the currently observed tempo, or `0` if no consistent value is found |
---|
88 | |
---|
89 | */ |
---|
90 | smpl_t aubio_tempo_get_bpm(aubio_tempo_t * o); |
---|
91 | |
---|
92 | /** get current tempo confidence |
---|
93 | |
---|
94 | \param o beat tracking object |
---|
95 | |
---|
96 | \return confidence with which the tempo has been observed, `0` if no |
---|
97 | consistent value is found. |
---|
98 | |
---|
99 | */ |
---|
100 | smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o); |
---|
101 | |
---|
102 | /** delete tempo detection object |
---|
103 | |
---|
104 | \param o beat tracking object |
---|
105 | |
---|
106 | */ |
---|
107 | void del_aubio_tempo(aubio_tempo_t * o); |
---|
108 | |
---|
109 | #ifdef __cplusplus |
---|
110 | } |
---|
111 | #endif |
---|
112 | |
---|
113 | #endif /* TEMPO_H */ |
---|