[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 |
---|
[0aa5208] | 29 | \example examples/aubiotrack.c |
---|
[69b11d8] | 30 | |
---|
[d88ea06] | 31 | */ |
---|
| 32 | |
---|
[7524d0b] | 33 | #ifndef TEMPO_H |
---|
| 34 | #define TEMPO_H |
---|
| 35 | |
---|
| 36 | #ifdef __cplusplus |
---|
| 37 | extern "C" { |
---|
| 38 | #endif |
---|
| 39 | |
---|
[d88ea06] | 40 | /** tempo detection structure */ |
---|
[7524d0b] | 41 | typedef struct _aubio_tempo_t aubio_tempo_t; |
---|
| 42 | |
---|
[7efeffd] | 43 | /** create tempo detection object |
---|
| 44 | |
---|
[fdd5315] | 45 | \param method beat tracking method, unused for now (use "default") |
---|
[7efeffd] | 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 (char_t * method, |
---|
[d207300] | 54 | uint_t buf_size, uint_t hop_size, uint_t samplerate); |
---|
[7524d0b] | 55 | |
---|
[7efeffd] | 56 | /** execute tempo detection |
---|
| 57 | |
---|
| 58 | \param o beat tracking object |
---|
| 59 | \param input new samples |
---|
| 60 | \param tempo output beats |
---|
| 61 | |
---|
| 62 | */ |
---|
[5bf23f7] | 63 | void aubio_tempo_do (aubio_tempo_t *o, fvec_t * input, fvec_t * tempo); |
---|
[7524d0b] | 64 | |
---|
[483b883] | 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 | |
---|
[7efeffd] | 86 | /** set tempo detection silence threshold |
---|
| 87 | |
---|
| 88 | \param o beat tracking object |
---|
[5899752] | 89 | \param silence new silence threshold, in dB |
---|
[7efeffd] | 90 | |
---|
| 91 | \return `0` if successful, non-zero otherwise |
---|
| 92 | |
---|
| 93 | */ |
---|
[0a257a6] | 94 | uint_t aubio_tempo_set_silence(aubio_tempo_t * o, smpl_t silence); |
---|
[7524d0b] | 95 | |
---|
[7efeffd] | 96 | /** set tempo detection peak picking threshold |
---|
| 97 | |
---|
| 98 | \param o beat tracking object |
---|
| 99 | \param threshold new threshold |
---|
| 100 | |
---|
| 101 | \return `0` if successful, non-zero otherwise |
---|
| 102 | |
---|
| 103 | */ |
---|
[0a257a6] | 104 | uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold); |
---|
[7524d0b] | 105 | |
---|
[cb0415d] | 106 | /** get current tempo |
---|
| 107 | |
---|
[7efeffd] | 108 | \param o beat tracking object |
---|
[cb0415d] | 109 | |
---|
[7efeffd] | 110 | \return the currently observed tempo, or `0` if no consistent value is found |
---|
[cb0415d] | 111 | |
---|
| 112 | */ |
---|
[7efeffd] | 113 | smpl_t aubio_tempo_get_bpm(aubio_tempo_t * o); |
---|
[cb0415d] | 114 | |
---|
[e34b010] | 115 | /** get current tempo confidence |
---|
| 116 | |
---|
[7efeffd] | 117 | \param o beat tracking object |
---|
[e34b010] | 118 | |
---|
[7efeffd] | 119 | \return confidence with which the tempo has been observed, `0` if no |
---|
[e34b010] | 120 | consistent value is found. |
---|
| 121 | |
---|
| 122 | */ |
---|
[7efeffd] | 123 | smpl_t aubio_tempo_get_confidence(aubio_tempo_t * o); |
---|
| 124 | |
---|
| 125 | /** delete tempo detection object |
---|
[e34b010] | 126 | |
---|
[7efeffd] | 127 | \param o beat tracking object |
---|
| 128 | |
---|
| 129 | */ |
---|
[7524d0b] | 130 | void del_aubio_tempo(aubio_tempo_t * o); |
---|
| 131 | |
---|
| 132 | #ifdef __cplusplus |
---|
| 133 | } |
---|
| 134 | #endif |
---|
| 135 | |
---|
| 136 | #endif /* TEMPO_H */ |
---|