source: src/tempo/tempo.h @ 2e50800

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 2e50800 was 483b883, checked in by Paul Brossier <piem@piem.org>, 12 years ago

src/tempo/tempo.c: add get_last functions

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[7524d0b]1/*
[e6a78ea]2  Copyright (C) 2006-2009 Paul Brossier <piem@aubio.org>
[7524d0b]3
[e6a78ea]4  This file is part of aubio.
[7524d0b]5
[e6a78ea]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.
[7524d0b]10
[e6a78ea]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/>.
[7524d0b]18
19*/
20
[7efeffd]21/** \file
22
[c25d5b5]23  Tempo detection object
[d88ea06]24
25  This object stores all the memory required for tempo detection algorithm
26  and returns the estimated beat locations.
27
[e230bb4]28  \example tempo/test-tempo.c
[69b11d8]29
[d88ea06]30*/
31
[7524d0b]32#ifndef TEMPO_H
33#define TEMPO_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
[d88ea06]39/** tempo detection structure */
[7524d0b]40typedef struct _aubio_tempo_t aubio_tempo_t;
41
[7efeffd]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*/
51aubio_tempo_t * new_aubio_tempo (char_t * method,
[d207300]52    uint_t buf_size, uint_t hop_size, uint_t samplerate);
[7524d0b]53
[7efeffd]54/** execute tempo detection
55
56  \param o beat tracking object
57  \param input new samples
58  \param tempo output beats
59
60*/
[5bf23f7]61void aubio_tempo_do (aubio_tempo_t *o, fvec_t * input, fvec_t * tempo);
[7524d0b]62
[483b883]63/** get the time of the latest beat detected, in samples
64
65  \param o tempo detection object as returned by ::new_aubio_tempo
66
67*/
68uint_t aubio_tempo_get_last (aubio_tempo_t *o);
69
70/** get the time of the latest beat detected, in seconds
71
72  \param o tempo detection object as returned by ::new_aubio_tempo
73
74*/
75smpl_t aubio_tempo_get_last_s (aubio_tempo_t *o);
76
77/** get the time of the latest beat detected, in milliseconds
78
79  \param o tempo detection object as returned by ::new_aubio_tempo
80
81*/
82smpl_t aubio_tempo_get_last_ms (aubio_tempo_t *o);
83
[7efeffd]84/** set tempo detection silence threshold
85
86  \param o beat tracking object
87  \param threshold new silence threshold, in dB
88
89  \return `0` if successful, non-zero otherwise
90
91*/
[0a257a6]92uint_t aubio_tempo_set_silence(aubio_tempo_t * o, smpl_t silence);
[7524d0b]93
[7efeffd]94/** set tempo detection peak picking threshold
95
96  \param o beat tracking object
97  \param threshold new threshold
98
99  \return `0` if successful, non-zero otherwise
100
101*/
[0a257a6]102uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold);
[7524d0b]103
[cb0415d]104/** get current tempo
105
[7efeffd]106  \param o beat tracking object
[cb0415d]107
[7efeffd]108  \return the currently observed tempo, or `0` if no consistent value is found
[cb0415d]109
110*/
[7efeffd]111smpl_t aubio_tempo_get_bpm(aubio_tempo_t * o);
[cb0415d]112
[e34b010]113/** get current tempo confidence
114
[7efeffd]115  \param o beat tracking object
[e34b010]116
[7efeffd]117  \return confidence with which the tempo has been observed, `0` if no
[e34b010]118  consistent value is found.
119
120*/
[7efeffd]121smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o);
122
123/** delete tempo detection object
[e34b010]124
[7efeffd]125  \param o beat tracking object
126
127*/
[7524d0b]128void del_aubio_tempo(aubio_tempo_t * o);
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif /* TEMPO_H */
Note: See TracBrowser for help on using the repository browser.