2 Copyright (C) 2006-2009 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 Tempo detection object
25 This object stores all the memory required for tempo detection algorithm
26 and returns the estimated beat locations.
28 \example tempo/test-tempo.c
39 /** tempo detection structure */
40 typedef struct _aubio_tempo_t aubio_tempo_t;
42 /** create tempo detection object
44 \param method beat tracking method, unused for now (use "default")
45 \param buf_size length of FFT
46 \param hop_size number of frames between two consecutive runs
47 \param samplerate sampling rate of the signal to analyze
49 \return newly created ::aubio_tempo_t if successful, `NULL` otherwise
52 aubio_tempo_t * new_aubio_tempo (char_t * method,
53 uint_t buf_size, uint_t hop_size, uint_t samplerate);
55 /** execute tempo detection
57 \param o beat tracking object
58 \param input new samples
59 \param tempo output beats
62 void aubio_tempo_do (aubio_tempo_t *o, fvec_t * input, fvec_t * tempo);
64 /** get the time of the latest beat detected, in samples
66 \param o tempo detection object as returned by ::new_aubio_tempo
69 uint_t aubio_tempo_get_last (aubio_tempo_t *o);
71 /** get the time of the latest beat detected, in seconds
73 \param o tempo detection object as returned by ::new_aubio_tempo
76 smpl_t aubio_tempo_get_last_s (aubio_tempo_t *o);
78 /** get the time of the latest beat detected, in milliseconds
80 \param o tempo detection object as returned by ::new_aubio_tempo
83 smpl_t aubio_tempo_get_last_ms (aubio_tempo_t *o);
85 /** set tempo detection silence threshold
87 \param o beat tracking object
88 \param silence new silence threshold, in dB
90 \return `0` if successful, non-zero otherwise
93 uint_t aubio_tempo_set_silence(aubio_tempo_t * o, smpl_t silence);
95 /** set tempo detection peak picking threshold
97 \param o beat tracking object
98 \param threshold new threshold
100 \return `0` if successful, non-zero otherwise
103 uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold);
105 /** get current tempo
107 \param o beat tracking object
109 \return the currently observed tempo, or `0` if no consistent value is found
112 smpl_t aubio_tempo_get_bpm(aubio_tempo_t * o);
114 /** get current tempo confidence
116 \param o beat tracking object
118 \return confidence with which the tempo has been observed, `0` if no
119 consistent value is found.
122 smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o);
124 /** delete tempo detection object
126 \param o beat tracking object
129 void del_aubio_tempo(aubio_tempo_t * o);