[b78805a] | 1 | /* |
---|
[f45dd12] | 2 | Copyright (C) 2003-2015 Matthew Davies and Paul Brossier <piem@aubio.org> |
---|
[b78805a] | 3 | |
---|
[e6a78ea] | 4 | This file is part of aubio. |
---|
| 5 | |
---|
| 6 | aubio is free software: you can redistribute it and/or modify |
---|
[ebfbd15] | 7 | it under the terms of the GNU General Public License as published by |
---|
[e6a78ea] | 8 | the Free Software Foundation, either version 3 of the License, or |
---|
[ebfbd15] | 9 | (at your option) any later version. |
---|
[b78805a] | 10 | |
---|
[e6a78ea] | 11 | aubio is distributed in the hope that it will be useful, |
---|
[ebfbd15] | 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. |
---|
[b78805a] | 15 | |
---|
[ebfbd15] | 16 | You should have received a copy of the GNU General Public License |
---|
[e6a78ea] | 17 | along with aubio. If not, see <http://www.gnu.org/licenses/>. |
---|
| 18 | |
---|
[b78805a] | 19 | */ |
---|
| 20 | |
---|
[ebfbd15] | 21 | /** \file |
---|
| 22 | |
---|
| 23 | Beat tracking using a context dependant model |
---|
| 24 | |
---|
[24d4433] | 25 | This file implements the causal beat tracking algorithm designed by Matthew |
---|
[ebfbd15] | 26 | Davies and described in the following articles: |
---|
| 27 | |
---|
| 28 | Matthew E. P. Davies and Mark D. Plumbley. Causal tempo tracking of audio. |
---|
| 29 | In Proceedings of the International Symposium on Music Information Retrieval |
---|
| 30 | (ISMIR), pages 164169, Barcelona, Spain, 2004. |
---|
| 31 | |
---|
| 32 | Matthew E. P. Davies, Paul Brossier, and Mark D. Plumbley. Beat tracking |
---|
| 33 | towards automatic musical accompaniment. In Proceedings of the Audio |
---|
| 34 | Engeeniring Society 118th Convention, Barcelona, Spain, May 2005. |
---|
[b173ca1] | 35 | |
---|
[e230bb4] | 36 | \example tempo/test-beattracking.c |
---|
[f45dd12] | 37 | |
---|
[ebfbd15] | 38 | */ |
---|
[6f42c16] | 39 | #ifndef AUBIO_BEATTRACKING_H |
---|
| 40 | #define AUBIO_BEATTRACKING_H |
---|
[b78805a] | 41 | |
---|
| 42 | #ifdef __cplusplus |
---|
| 43 | extern "C" { |
---|
| 44 | #endif |
---|
| 45 | |
---|
[ebfbd15] | 46 | /** beat tracking object */ |
---|
[b78805a] | 47 | typedef struct _aubio_beattracking_t aubio_beattracking_t; |
---|
[ebfbd15] | 48 | |
---|
| 49 | /** create beat tracking object |
---|
| 50 | |
---|
[fd46d1e] | 51 | \param winlen length of the onset detection window |
---|
[f45dd12] | 52 | \param hop_size number of onset detection samples [512] |
---|
[fd46d1e] | 53 | \param samplerate samplerate of the input signal |
---|
[ebfbd15] | 54 | |
---|
| 55 | */ |
---|
[77db425] | 56 | aubio_beattracking_t * new_aubio_beattracking(uint_t winlen, uint_t hop_size, |
---|
| 57 | uint_t samplerate); |
---|
[3ac7cb0] | 58 | |
---|
[f45dd12] | 59 | /** track the beat |
---|
[ebfbd15] | 60 | |
---|
| 61 | \param bt beat tracking object |
---|
| 62 | \param dfframes current input detection function frame, smoothed by |
---|
[f45dd12] | 63 | adaptive median threshold. |
---|
| 64 | \param out stored detected beat locations |
---|
[ebfbd15] | 65 | |
---|
| 66 | */ |
---|
[69f74f0] | 67 | void aubio_beattracking_do (aubio_beattracking_t * bt, const fvec_t * dfframes, |
---|
[3ac7cb0] | 68 | fvec_t * out); |
---|
| 69 | |
---|
[5f5edc1] | 70 | /** get current beat period in samples |
---|
| 71 | |
---|
| 72 | \param bt beat tracking object |
---|
| 73 | |
---|
| 74 | Returns the currently observed period, in samples, or 0 if no consistent |
---|
| 75 | value is found. |
---|
| 76 | |
---|
| 77 | */ |
---|
[69f74f0] | 78 | smpl_t aubio_beattracking_get_period (const aubio_beattracking_t * bt); |
---|
[5f5edc1] | 79 | |
---|
| 80 | /** get current beat period in seconds |
---|
| 81 | |
---|
| 82 | \param bt beat tracking object |
---|
| 83 | |
---|
| 84 | Returns the currently observed period, in seconds, or 0 if no consistent |
---|
| 85 | value is found. |
---|
| 86 | |
---|
| 87 | */ |
---|
[69f74f0] | 88 | smpl_t aubio_beattracking_get_period_s (const aubio_beattracking_t * bt); |
---|
[5f5edc1] | 89 | |
---|
[416c0b5] | 90 | /** get current tempo in bpm |
---|
| 91 | |
---|
| 92 | \param bt beat tracking object |
---|
| 93 | |
---|
| 94 | Returns the currently observed tempo, in beats per minutes, or 0 if no |
---|
| 95 | consistent value is found. |
---|
| 96 | |
---|
| 97 | */ |
---|
[69f74f0] | 98 | smpl_t aubio_beattracking_get_bpm(const aubio_beattracking_t * bt); |
---|
[3ac7cb0] | 99 | |
---|
[f45dd12] | 100 | /** get current tempo confidence |
---|
[e34b010] | 101 | |
---|
| 102 | \param bt beat tracking object |
---|
| 103 | |
---|
| 104 | Returns the confidence with which the tempo has been observed, 0 if no |
---|
| 105 | consistent value is found. |
---|
| 106 | |
---|
| 107 | */ |
---|
[69f74f0] | 108 | smpl_t aubio_beattracking_get_confidence(const aubio_beattracking_t * bt); |
---|
[3ac7cb0] | 109 | |
---|
[ebfbd15] | 110 | /** delete beat tracking object |
---|
| 111 | |
---|
| 112 | \param p beat tracking object |
---|
| 113 | |
---|
| 114 | */ |
---|
[b78805a] | 115 | void del_aubio_beattracking(aubio_beattracking_t * p); |
---|
| 116 | |
---|
| 117 | #ifdef __cplusplus |
---|
| 118 | } |
---|
| 119 | #endif |
---|
| 120 | |
---|
[6f42c16] | 121 | #endif /* AUBIO_BEATTRACKING_H */ |
---|