[96fb8ad] | 1 | /* |
---|
| 2 | Copyright (C) 2003 Paul Brossier |
---|
| 3 | |
---|
| 4 | This program is free software; you can redistribute it and/or modify |
---|
| 5 | it under the terms of the GNU General Public License as published by |
---|
| 6 | the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | (at your option) any later version. |
---|
| 8 | |
---|
| 9 | This program is distributed in the hope that it will be useful, |
---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | GNU General Public License for more details. |
---|
| 13 | |
---|
| 14 | You should have received a copy of the GNU General Public License |
---|
| 15 | along with this program; if not, write to the Free Software |
---|
| 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 17 | |
---|
| 18 | */ |
---|
| 19 | |
---|
[6ebcb08] | 20 | /** \file |
---|
| 21 | |
---|
| 22 | Onset detection functions |
---|
| 23 | |
---|
| 24 | All of the following onset detection function take as arguments the FFT of a |
---|
| 25 | windowed signal (as created with aubio_pvoc). They output one smpl_t per |
---|
| 26 | buffer and per channel (stored in a vector of size [channels]x[1]). |
---|
| 27 | |
---|
| 28 | These functions were first adapted from Juan Pablo Bello's code, and now |
---|
| 29 | include further improvements and modifications made within aubio. |
---|
| 30 | |
---|
| 31 | */ |
---|
[96fb8ad] | 32 | |
---|
| 33 | |
---|
| 34 | #ifndef ONSETDETECTION_H |
---|
| 35 | #define ONSETDETECTION_H |
---|
| 36 | |
---|
| 37 | #ifdef __cplusplus |
---|
| 38 | extern "C" { |
---|
| 39 | #endif |
---|
| 40 | |
---|
| 41 | /** onsetdetection types */ |
---|
| 42 | typedef enum { |
---|
[5cf415f] | 43 | aubio_onset_energy, /**< energy based */ |
---|
| 44 | aubio_onset_specdiff, /**< spectral diff */ |
---|
| 45 | aubio_onset_hfc, /**< high frequency content */ |
---|
| 46 | aubio_onset_complex, /**< complex domain */ |
---|
| 47 | aubio_onset_phase, /**< phase fast */ |
---|
[6ebcb08] | 48 | aubio_onset_kl, /**< Kullback Liebler */ |
---|
[ec2fa2a] | 49 | aubio_onset_mkl, /**< modified Kullback Liebler */ |
---|
[fabb7cd] | 50 | aubio_onset_specflux, /**< spectral flux */ |
---|
[96fb8ad] | 51 | } aubio_onsetdetection_type; |
---|
| 52 | |
---|
| 53 | /** onsetdetection structure */ |
---|
| 54 | typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t; |
---|
| 55 | /** Energy based onset detection function |
---|
[6ebcb08] | 56 | |
---|
| 57 | This function calculates the local energy of the input spectral frame. |
---|
| 58 | |
---|
[bd24069] | 59 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 60 | \param fftgrain input spectral frame |
---|
| 61 | \param onset output onset detection function |
---|
| 62 | |
---|
| 63 | */ |
---|
[96fb8ad] | 64 | void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 65 | /** High Frequency Content onset detection function |
---|
[6ebcb08] | 66 | |
---|
| 67 | This method computes the High Frequency Content (HFC) of the input spectral |
---|
| 68 | frame. The resulting function is efficient at detecting percussive onsets. |
---|
| 69 | |
---|
| 70 | Paul Masri. Computer modeling of Sound for Transformation and Synthesis of |
---|
| 71 | Musical Signal. PhD dissertation, University of Bristol, UK, 1996. |
---|
| 72 | |
---|
[bd24069] | 73 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 74 | \param fftgrain input spectral frame |
---|
| 75 | \param onset output onset detection function |
---|
| 76 | |
---|
| 77 | */ |
---|
[96fb8ad] | 78 | void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 79 | /** Complex Domain Method onset detection function |
---|
[6ebcb08] | 80 | |
---|
| 81 | Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain |
---|
| 82 | onset detection for musical signals. In Proceedings of the Digital Audio |
---|
[bd24069] | 83 | Effects Conference, DAFx-03, pages 90-93, London, UK, 2003. |
---|
[6ebcb08] | 84 | |
---|
[bd24069] | 85 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 86 | \param fftgrain input spectral frame |
---|
| 87 | \param onset output onset detection function |
---|
| 88 | |
---|
| 89 | */ |
---|
[96fb8ad] | 90 | void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 91 | /** Phase Based Method onset detection function |
---|
[6ebcb08] | 92 | |
---|
| 93 | Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset |
---|
| 94 | detection for music signals. In Proceedings of the IEEE International |
---|
| 95 | Conference on Acoustics Speech and Signal Processing, pages 441444, |
---|
| 96 | Hong-Kong, 2003. |
---|
| 97 | |
---|
[bd24069] | 98 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 99 | \param fftgrain input spectral frame |
---|
| 100 | \param onset output onset detection function |
---|
| 101 | |
---|
| 102 | */ |
---|
[96fb8ad] | 103 | void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 104 | /** Spectral difference method onset detection function |
---|
[6ebcb08] | 105 | |
---|
| 106 | Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to |
---|
| 107 | rhythm analysis. In IEEE International Conference on Multimedia and Expo |
---|
| 108 | (ICME 2001), pages 881884, Tokyo, Japan, August 2001. |
---|
| 109 | |
---|
[bd24069] | 110 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 111 | \param fftgrain input spectral frame |
---|
| 112 | \param onset output onset detection function |
---|
| 113 | |
---|
| 114 | */ |
---|
[96fb8ad] | 115 | void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
[6ebcb08] | 116 | /** Kullback-Liebler onset detection function |
---|
| 117 | |
---|
| 118 | Stephen Hainsworth and Malcom Macleod. Onset detection in music audio |
---|
| 119 | signals. In Proceedings of the International Computer Music Conference |
---|
| 120 | (ICMC), Singapore, 2003. |
---|
| 121 | |
---|
[bd24069] | 122 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 123 | \param fftgrain input spectral frame |
---|
| 124 | \param onset output onset detection function |
---|
| 125 | |
---|
| 126 | */ |
---|
[b31f262] | 127 | void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
[6ebcb08] | 128 | /** Modified Kullback-Liebler onset detection function |
---|
| 129 | |
---|
| 130 | Paul Brossier, ``Automatic annotation of musical audio for interactive |
---|
| 131 | systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital |
---|
[e8830c4] | 132 | music, Queen Mary University of London, London, UK, 2006. |
---|
[6ebcb08] | 133 | |
---|
[bd24069] | 134 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 135 | \param fftgrain input spectral frame |
---|
| 136 | \param onset output onset detection function |
---|
| 137 | |
---|
| 138 | */ |
---|
[b31f262] | 139 | void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
[fabb7cd] | 140 | /** Spectral Flux |
---|
| 141 | |
---|
| 142 | Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th |
---|
| 143 | International Conference on Digital Audio Effects'' (DAFx-06), Montreal, |
---|
| 144 | Canada, 2006. |
---|
| 145 | |
---|
| 146 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 147 | \param fftgrain input spectral frame |
---|
| 148 | \param onset output onset detection function |
---|
| 149 | |
---|
| 150 | */ |
---|
| 151 | void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
[6ebcb08] | 152 | /** execute onset detection function on a spectral frame |
---|
| 153 | |
---|
| 154 | Generic function to compute onset detection. |
---|
| 155 | |
---|
[bd24069] | 156 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 157 | \param fftgrain input signal spectrum as computed by aubio_pvoc_do |
---|
| 158 | \param onset output vector (one sample long, to send to the peak picking) |
---|
| 159 | |
---|
| 160 | */ |
---|
[96fb8ad] | 161 | void aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
[6ebcb08] | 162 | /** creation of an onset detection object |
---|
| 163 | |
---|
| 164 | \param type onset detection mode |
---|
| 165 | \param size length of the input spectrum frame |
---|
| 166 | \param channels number of input channels |
---|
| 167 | |
---|
| 168 | */ |
---|
[96fb8ad] | 169 | aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels); |
---|
[6ebcb08] | 170 | /** deletion of an onset detection object |
---|
| 171 | |
---|
[bd24069] | 172 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
[6ebcb08] | 173 | |
---|
| 174 | */ |
---|
[e9d8cfe] | 175 | void del_aubio_onsetdetection(aubio_onsetdetection_t *o); |
---|
| 176 | |
---|
[96fb8ad] | 177 | #ifdef __cplusplus |
---|
| 178 | } |
---|
| 179 | #endif |
---|
| 180 | |
---|
| 181 | #endif /* ONSETDETECTION_H */ |
---|