aubio 0.4.9

Loading...
Searching...
No Matches
tempo.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2006-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 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 \example examples/aubiotrack.c
30
31*/
32
33#ifndef AUBIO_TEMPO_H
34#define AUBIO_TEMPO_H
35
36#ifdef __cplusplus
37 extern "C" {
38#endif
39
40/** tempo detection structure */
41 typedef struct _aubio_tempo_t aubio_tempo_t;
42
43/** create tempo detection object
44
45 \param method beat tracking method, unused for now (use "default")
46 \param buf_size length of FFT
47 \param hop_size number of frames between two consecutive runs
48 \param samplerate sampling rate of the signal to analyze
49
50 \return newly created ::aubio_tempo_t if successful, `NULL` otherwise
51
52*/
53 aubio_tempo_t * new_aubio_tempo (const char_t * method,
54 uint_t buf_size, uint_t hop_size, uint_t samplerate);
55
56/** execute tempo detection
57
58 \param o beat tracking object
59 \param input new samples
60 \param tempo output beats
61
62*/
63 void aubio_tempo_do (aubio_tempo_t *o, const fvec_t * input, fvec_t * tempo);
64
65/** get the time of the latest beat detected, in samples
66
67 \param o tempo detection object as returned by ::new_aubio_tempo
68
69*/
70 uint_t aubio_tempo_get_last (aubio_tempo_t *o);
71
72/** get the time of the latest beat detected, in seconds
73
74 \param o tempo detection object as returned by ::new_aubio_tempo
75
76*/
77 smpl_t aubio_tempo_get_last_s (aubio_tempo_t *o);
78
79/** get the time of the latest beat detected, in milliseconds
80
81 \param o tempo detection object as returned by ::new_aubio_tempo
82
83*/
84 smpl_t aubio_tempo_get_last_ms (aubio_tempo_t *o);
85
86/** set tempo detection silence threshold
87
88 \param o beat tracking object
89 \param silence new silence threshold, in dB
90
91 \return `0` if successful, non-zero otherwise
92
93*/
94 uint_t aubio_tempo_set_silence(aubio_tempo_t * o, smpl_t silence);
95
96/** get tempo detection silence threshold
97
98 \param o tempo detection object as returned by new_aubio_tempo()
99
100 \return current silence threshold
101
102*/
103 smpl_t aubio_tempo_get_silence(aubio_tempo_t * o);
104
105/** set tempo detection peak picking threshold
106
107 \param o beat tracking object
108 \param threshold new threshold
109
110 \return `0` if successful, non-zero otherwise
111
112*/
113 uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold);
114
115/** get tempo peak picking threshold
116
117 \param o tempo detection object as returned by new_aubio_tempo()
118
119 \return current tempo detection threshold
120
121*/
122 smpl_t aubio_tempo_get_threshold(aubio_tempo_t * o);
123
124/** get current beat period in samples
125
126 \param bt beat tracking object
127
128 Returns the currently observed period, in samples, or 0 if no consistent
129 value is found.
130
131*/
132 smpl_t aubio_tempo_get_period (aubio_tempo_t * bt);
133
134/** get current beat period in seconds
135
136 \param bt beat tracking object
137
138 Returns the currently observed period, in seconds, or 0 if no consistent
139 value is found.
140
141*/
142 smpl_t aubio_tempo_get_period_s (aubio_tempo_t * bt);
143
144/** get current tempo
145
146 \param o beat tracking object
147
148 \return the currently observed tempo, or `0` if no consistent value is found
149
150*/
151 smpl_t aubio_tempo_get_bpm(aubio_tempo_t * o);
152
153/** get current tempo confidence
154
155 \param o beat tracking object
156
157 \return confidence with which the tempo has been observed, the higher the
158 more confidence, `0` if no consistent value is found.
159
160*/
161 smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o);
162
163/** set number of tatum per beat
164
165 \param o beat tracking object
166 \param signature number of tatum per beat (between 1 and 64)
167
168*/
169 uint_t aubio_tempo_set_tatum_signature(aubio_tempo_t *o, uint_t signature);
170
171/** check whether a tatum was detected in the current frame
172
173 \param o beat tracking object
174
175 \return 2 if a beat was detected, 1 if a tatum was detected, 0 otherwise
176
177*/
178 uint_t aubio_tempo_was_tatum(aubio_tempo_t *o);
179
180/** get position of last_tatum, in samples
181
182 \param o beat tracking object
183
184*/
185 smpl_t aubio_tempo_get_last_tatum(aubio_tempo_t *o);
186
187/** get current delay
188
189 \param o beat tracking object
190
191 \return current delay, in samples
192
193 */
194 uint_t aubio_tempo_get_delay(aubio_tempo_t * o);
195
196/** get current delay in seconds
197
198 \param o beat tracking object
199
200 \return current delay, in seconds
201
202 */
203 smpl_t aubio_tempo_get_delay_s(aubio_tempo_t * o);
204
205/** get current delay in ms
206
207 \param o beat tracking object
208
209 \return current delay, in milliseconds
210
211 */
212 smpl_t aubio_tempo_get_delay_ms(aubio_tempo_t * o);
213
214/** set current delay
215
216 \param o beat tracking object
217 \param delay delay to set tempo to, in samples
218
219 \return `0` if successful, non-zero otherwise
220
221 */
222 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, sint_t delay);
223
224/** set current delay in seconds
225
226 \param o beat tracking object
227 \param delay delay to set tempo to, in seconds
228
229 \return `0` if successful, non-zero otherwise
230
231 */
232 uint_t aubio_tempo_set_delay_s(aubio_tempo_t * o, smpl_t delay);
233
234/** set current delay
235
236 \param o beat tracking object
237 \param delay delay to set tempo to, in samples
238
239 \return `0` if successful, non-zero otherwise
240
241 */
242 uint_t aubio_tempo_set_delay_ms(aubio_tempo_t * o, smpl_t delay);
243
244/** delete tempo detection object
245
246 \param o beat tracking object
247
248*/
249 void del_aubio_tempo(aubio_tempo_t * o);
250
251#ifdef __cplusplus
252}
253#endif
254
255#endif /* AUBIO_TEMPO_H */
fvec_t
Buffer for real data.
Definition: fvec.h:67
aubio_tempo_get_last_tatum
smpl_t aubio_tempo_get_last_tatum(aubio_tempo_t *o)
get position of last_tatum, in samples
aubio_tempo_get_confidence
smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o)
get current tempo confidence
aubio_tempo_set_delay_s
uint_t aubio_tempo_set_delay_s(aubio_tempo_t *o, smpl_t delay)
set current delay in seconds
aubio_tempo_get_delay_ms
smpl_t aubio_tempo_get_delay_ms(aubio_tempo_t *o)
get current delay in ms
aubio_tempo_set_delay_ms
uint_t aubio_tempo_set_delay_ms(aubio_tempo_t *o, smpl_t delay)
set current delay
aubio_tempo_get_threshold
smpl_t aubio_tempo_get_threshold(aubio_tempo_t *o)
get tempo peak picking threshold
aubio_tempo_set_silence
uint_t aubio_tempo_set_silence(aubio_tempo_t *o, smpl_t silence)
set tempo detection silence threshold
new_aubio_tempo
aubio_tempo_t * new_aubio_tempo(const char_t *method, uint_t buf_size, uint_t hop_size, uint_t samplerate)
create tempo detection object
del_aubio_tempo
void del_aubio_tempo(aubio_tempo_t *o)
delete tempo detection object
aubio_tempo_t
struct _aubio_tempo_t aubio_tempo_t
tempo detection structure
Definition: tempo.h:41
aubio_tempo_get_last_s
smpl_t aubio_tempo_get_last_s(aubio_tempo_t *o)
get the time of the latest beat detected, in seconds
aubio_tempo_set_delay
uint_t aubio_tempo_set_delay(aubio_tempo_t *o, sint_t delay)
set current delay
aubio_tempo_set_threshold
uint_t aubio_tempo_set_threshold(aubio_tempo_t *o, smpl_t threshold)
set tempo detection peak picking threshold
aubio_tempo_get_last
uint_t aubio_tempo_get_last(aubio_tempo_t *o)
get the time of the latest beat detected, in samples
aubio_tempo_do
void aubio_tempo_do(aubio_tempo_t *o, const fvec_t *input, fvec_t *tempo)
execute tempo detection
aubio_tempo_get_last_ms
smpl_t aubio_tempo_get_last_ms(aubio_tempo_t *o)
get the time of the latest beat detected, in milliseconds
aubio_tempo_get_delay
uint_t aubio_tempo_get_delay(aubio_tempo_t *o)
get current delay
aubio_tempo_get_bpm
smpl_t aubio_tempo_get_bpm(aubio_tempo_t *o)
get current tempo
aubio_tempo_set_tatum_signature
uint_t aubio_tempo_set_tatum_signature(aubio_tempo_t *o, uint_t signature)
set number of tatum per beat
aubio_tempo_get_silence
smpl_t aubio_tempo_get_silence(aubio_tempo_t *o)
get tempo detection silence threshold
aubio_tempo_was_tatum
uint_t aubio_tempo_was_tatum(aubio_tempo_t *o)
check whether a tatum was detected in the current frame
aubio_tempo_get_delay_s
smpl_t aubio_tempo_get_delay_s(aubio_tempo_t *o)
get current delay in seconds
aubio_tempo_get_period_s
smpl_t aubio_tempo_get_period_s(aubio_tempo_t *bt)
get current beat period in seconds
aubio_tempo_get_period
smpl_t aubio_tempo_get_period(aubio_tempo_t *bt)
get current beat period in samples
uint_t
unsigned int uint_t
unsigned integer
Definition: types.h:60
char_t
char char_t
character
Definition: types.h:64
smpl_t
float smpl_t
short sample format (32 or 64 bits)
Definition: types.h:41
sint_t
int sint_t
signed integer
Definition: types.h:62