[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 | |
---|
| 20 | #include "aubio_priv.h" |
---|
[6c7d49b] | 21 | #include "fvec.h" |
---|
| 22 | #include "cvec.h" |
---|
[32d6958] | 23 | #include "spectral/fft.h" |
---|
[96fb8ad] | 24 | #include "mathutils.h" |
---|
[32d6958] | 25 | #include "utils/hist.h" |
---|
[2d8cffa] | 26 | #include "onset/onsetdetection.h" |
---|
[96fb8ad] | 27 | |
---|
[1b88289] | 28 | /** Energy based onset detection function |
---|
| 29 | |
---|
| 30 | This function calculates the local energy of the input spectral frame. |
---|
| 31 | |
---|
| 32 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 33 | \param fftgrain input spectral frame |
---|
| 34 | \param onset output onset detection function |
---|
| 35 | |
---|
| 36 | */ |
---|
| 37 | void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 38 | /** High Frequency Content onset detection function |
---|
| 39 | |
---|
| 40 | This method computes the High Frequency Content (HFC) of the input spectral |
---|
| 41 | frame. The resulting function is efficient at detecting percussive onsets. |
---|
| 42 | |
---|
| 43 | Paul Masri. Computer modeling of Sound for Transformation and Synthesis of |
---|
| 44 | Musical Signal. PhD dissertation, University of Bristol, UK, 1996. |
---|
| 45 | |
---|
| 46 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 47 | \param fftgrain input spectral frame |
---|
| 48 | \param onset output onset detection function |
---|
| 49 | |
---|
| 50 | */ |
---|
| 51 | void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 52 | /** Complex Domain Method onset detection function |
---|
| 53 | |
---|
| 54 | Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain |
---|
| 55 | onset detection for musical signals. In Proceedings of the Digital Audio |
---|
| 56 | Effects Conference, DAFx-03, pages 90-93, London, UK, 2003. |
---|
| 57 | |
---|
| 58 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 59 | \param fftgrain input spectral frame |
---|
| 60 | \param onset output onset detection function |
---|
| 61 | |
---|
| 62 | */ |
---|
| 63 | void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 64 | /** Phase Based Method onset detection function |
---|
| 65 | |
---|
| 66 | Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset |
---|
| 67 | detection for music signals. In Proceedings of the IEEE International |
---|
| 68 | Conference on Acoustics Speech and Signal Processing, pages 441444, |
---|
| 69 | Hong-Kong, 2003. |
---|
| 70 | |
---|
| 71 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 72 | \param fftgrain input spectral frame |
---|
| 73 | \param onset output onset detection function |
---|
| 74 | |
---|
| 75 | */ |
---|
| 76 | void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 77 | /** Spectral difference method onset detection function |
---|
| 78 | |
---|
| 79 | Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to |
---|
| 80 | rhythm analysis. In IEEE International Conference on Multimedia and Expo |
---|
| 81 | (ICME 2001), pages 881884, Tokyo, Japan, August 2001. |
---|
| 82 | |
---|
| 83 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 84 | \param fftgrain input spectral frame |
---|
| 85 | \param onset output onset detection function |
---|
| 86 | |
---|
| 87 | */ |
---|
| 88 | void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 89 | /** Kullback-Liebler onset detection function |
---|
| 90 | |
---|
| 91 | Stephen Hainsworth and Malcom Macleod. Onset detection in music audio |
---|
| 92 | signals. In Proceedings of the International Computer Music Conference |
---|
| 93 | (ICMC), Singapore, 2003. |
---|
| 94 | |
---|
| 95 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 96 | \param fftgrain input spectral frame |
---|
| 97 | \param onset output onset detection function |
---|
| 98 | |
---|
| 99 | */ |
---|
| 100 | void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 101 | /** Modified Kullback-Liebler onset detection function |
---|
| 102 | |
---|
| 103 | Paul Brossier, ``Automatic annotation of musical audio for interactive |
---|
| 104 | systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital |
---|
| 105 | music, Queen Mary University of London, London, UK, 2006. |
---|
| 106 | |
---|
| 107 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 108 | \param fftgrain input spectral frame |
---|
| 109 | \param onset output onset detection function |
---|
| 110 | |
---|
| 111 | */ |
---|
| 112 | void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
| 113 | /** Spectral Flux |
---|
| 114 | |
---|
| 115 | Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th |
---|
| 116 | International Conference on Digital Audio Effects'' (DAFx-06), Montreal, |
---|
| 117 | Canada, 2006. |
---|
| 118 | |
---|
| 119 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
| 120 | \param fftgrain input spectral frame |
---|
| 121 | \param onset output onset detection function |
---|
| 122 | |
---|
| 123 | */ |
---|
| 124 | void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
[96fb8ad] | 125 | |
---|
[b740b96] | 126 | /** structure to store object state */ |
---|
[96fb8ad] | 127 | struct _aubio_onsetdetection_t { |
---|
[b740b96] | 128 | aubio_onsetdetection_type type; /**< onset detection type */ |
---|
| 129 | /** Pointer to aubio_onsetdetection_<type> function */ |
---|
| 130 | void (*funcpointer)(aubio_onsetdetection_t *o, |
---|
[ec2fa2a] | 131 | cvec_t * fftgrain, fvec_t * onset); |
---|
[b740b96] | 132 | smpl_t threshold; /**< minimum norm threshold for phase and specdiff */ |
---|
| 133 | fvec_t *oldmag; /**< previous norm vector */ |
---|
| 134 | fvec_t *dev1 ; /**< current onset detection measure vector */ |
---|
| 135 | fvec_t *theta1; /**< previous phase vector, one frame behind */ |
---|
| 136 | fvec_t *theta2; /**< previous phase vector, two frames behind */ |
---|
| 137 | aubio_hist_t * histog; /**< histogram */ |
---|
[96fb8ad] | 138 | }; |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | /* Energy based onset detection function */ |
---|
[b377d04] | 142 | void aubio_onsetdetection_energy (aubio_onsetdetection_t *o UNUSED, |
---|
[ec2fa2a] | 143 | cvec_t * fftgrain, fvec_t * onset) { |
---|
| 144 | uint_t i,j; |
---|
| 145 | for (i=0;i<fftgrain->channels;i++) { |
---|
| 146 | onset->data[i][0] = 0.; |
---|
| 147 | for (j=0;j<fftgrain->length;j++) { |
---|
| 148 | onset->data[i][0] += SQR(fftgrain->norm[i][j]); |
---|
| 149 | } |
---|
| 150 | } |
---|
[96fb8ad] | 151 | } |
---|
| 152 | |
---|
| 153 | /* High Frequency Content onset detection function */ |
---|
[b377d04] | 154 | void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o UNUSED, |
---|
| 155 | cvec_t * fftgrain, fvec_t * onset){ |
---|
[ec2fa2a] | 156 | uint_t i,j; |
---|
| 157 | for (i=0;i<fftgrain->channels;i++) { |
---|
| 158 | onset->data[i][0] = 0.; |
---|
| 159 | for (j=0;j<fftgrain->length;j++) { |
---|
| 160 | onset->data[i][0] += (j+1)*fftgrain->norm[i][j]; |
---|
| 161 | } |
---|
| 162 | } |
---|
[96fb8ad] | 163 | } |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | /* Complex Domain Method onset detection function */ |
---|
| 167 | void aubio_onsetdetection_complex (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset) { |
---|
[ec2fa2a] | 168 | uint_t i, j; |
---|
| 169 | uint_t nbins = fftgrain->length; |
---|
| 170 | for (i=0;i<fftgrain->channels; i++) { |
---|
| 171 | onset->data[i][0] = 0.; |
---|
| 172 | for (j=0;j<nbins; j++) { |
---|
[252a080] | 173 | // compute the predicted phase |
---|
| 174 | o->dev1->data[i][j] = 2. * o->theta1->data[i][j] - o->theta2->data[i][j]; |
---|
| 175 | // compute the euclidean distance in the complex domain |
---|
| 176 | // sqrt ( r_1^2 + r_2^2 - 2 * r_1 * r_2 * \cos ( \phi_1 - \phi_2 ) ) |
---|
| 177 | onset->data[i][0] += |
---|
| 178 | SQRT (ABS (SQR (o->oldmag->data[i][j]) + SQR (fftgrain->norm[i][j]) |
---|
| 179 | - 2. * o->oldmag->data[i][j] * fftgrain->norm[i][j] |
---|
| 180 | * COS (o->dev1->data[i][j] - fftgrain->phas[i][j]))); |
---|
[ec2fa2a] | 181 | /* swap old phase data (need to remember 2 frames behind)*/ |
---|
| 182 | o->theta2->data[i][j] = o->theta1->data[i][j]; |
---|
| 183 | o->theta1->data[i][j] = fftgrain->phas[i][j]; |
---|
| 184 | /* swap old magnitude data (1 frame is enough) */ |
---|
| 185 | o->oldmag->data[i][j] = fftgrain->norm[i][j]; |
---|
| 186 | } |
---|
| 187 | } |
---|
[96fb8ad] | 188 | } |
---|
| 189 | |
---|
| 190 | |
---|
| 191 | /* Phase Based Method onset detection function */ |
---|
| 192 | void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, |
---|
[ec2fa2a] | 193 | cvec_t * fftgrain, fvec_t * onset){ |
---|
| 194 | uint_t i, j; |
---|
| 195 | uint_t nbins = fftgrain->length; |
---|
| 196 | for (i=0;i<fftgrain->channels; i++) { |
---|
[acf7d30] | 197 | onset->data[i][0] = 0.0; |
---|
[ec2fa2a] | 198 | o->dev1->data[i][0]=0.; |
---|
| 199 | for ( j=0;j<nbins; j++ ) { |
---|
| 200 | o->dev1->data[i][j] = |
---|
| 201 | aubio_unwrap2pi( |
---|
| 202 | fftgrain->phas[i][j] |
---|
| 203 | -2.0*o->theta1->data[i][j] |
---|
| 204 | +o->theta2->data[i][j]); |
---|
| 205 | if ( o->threshold < fftgrain->norm[i][j] ) |
---|
| 206 | o->dev1->data[i][j] = ABS(o->dev1->data[i][j]); |
---|
| 207 | else |
---|
[acf7d30] | 208 | o->dev1->data[i][j] = 0.0; |
---|
[ec2fa2a] | 209 | /* keep a track of the past frames */ |
---|
| 210 | o->theta2->data[i][j] = o->theta1->data[i][j]; |
---|
| 211 | o->theta1->data[i][j] = fftgrain->phas[i][j]; |
---|
| 212 | } |
---|
| 213 | /* apply o->histogram */ |
---|
| 214 | aubio_hist_dyn_notnull(o->histog,o->dev1); |
---|
| 215 | /* weight it */ |
---|
| 216 | aubio_hist_weight(o->histog); |
---|
| 217 | /* its mean is the result */ |
---|
| 218 | onset->data[i][0] = aubio_hist_mean(o->histog); |
---|
[8b28524] | 219 | //onset->data[i][0] = fvec_mean(o->dev1); |
---|
[ec2fa2a] | 220 | } |
---|
[96fb8ad] | 221 | } |
---|
| 222 | |
---|
| 223 | /* Spectral difference method onset detection function */ |
---|
| 224 | void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, |
---|
[ec2fa2a] | 225 | cvec_t * fftgrain, fvec_t * onset){ |
---|
| 226 | uint_t i, j; |
---|
| 227 | uint_t nbins = fftgrain->length; |
---|
| 228 | for (i=0;i<fftgrain->channels; i++) { |
---|
[acf7d30] | 229 | onset->data[i][0] = 0.0; |
---|
[ec2fa2a] | 230 | for (j=0;j<nbins; j++) { |
---|
| 231 | o->dev1->data[i][j] = SQRT( |
---|
| 232 | ABS(SQR( fftgrain->norm[i][j]) |
---|
| 233 | - SQR(o->oldmag->data[i][j]))); |
---|
| 234 | if (o->threshold < fftgrain->norm[i][j] ) |
---|
| 235 | o->dev1->data[i][j] = ABS(o->dev1->data[i][j]); |
---|
| 236 | else |
---|
[acf7d30] | 237 | o->dev1->data[i][j] = 0.0; |
---|
[ec2fa2a] | 238 | o->oldmag->data[i][j] = fftgrain->norm[i][j]; |
---|
| 239 | } |
---|
[96fb8ad] | 240 | |
---|
[ec2fa2a] | 241 | /* apply o->histogram (act somewhat as a low pass on the |
---|
| 242 | * overall function)*/ |
---|
| 243 | aubio_hist_dyn_notnull(o->histog,o->dev1); |
---|
| 244 | /* weight it */ |
---|
| 245 | aubio_hist_weight(o->histog); |
---|
| 246 | /* its mean is the result */ |
---|
| 247 | onset->data[i][0] = aubio_hist_mean(o->histog); |
---|
[96fb8ad] | 248 | |
---|
[ec2fa2a] | 249 | } |
---|
[96fb8ad] | 250 | } |
---|
| 251 | |
---|
[b31f262] | 252 | /* Kullback Liebler onset detection function |
---|
| 253 | * note we use ln(1+Xn/(Xn-1+0.0001)) to avoid |
---|
| 254 | * negative (1.+) and infinite values (+1.e-10) */ |
---|
| 255 | void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){ |
---|
[ec2fa2a] | 256 | uint_t i,j; |
---|
| 257 | for (i=0;i<fftgrain->channels;i++) { |
---|
| 258 | onset->data[i][0] = 0.; |
---|
| 259 | for (j=0;j<fftgrain->length;j++) { |
---|
| 260 | onset->data[i][0] += fftgrain->norm[i][j] |
---|
| 261 | *LOG(1.+fftgrain->norm[i][j]/(o->oldmag->data[i][j]+1.e-10)); |
---|
| 262 | o->oldmag->data[i][j] = fftgrain->norm[i][j]; |
---|
| 263 | } |
---|
| 264 | if (isnan(onset->data[i][0])) onset->data[i][0] = 0.; |
---|
| 265 | } |
---|
[b31f262] | 266 | } |
---|
| 267 | |
---|
| 268 | /* Modified Kullback Liebler onset detection function |
---|
| 269 | * note we use ln(1+Xn/(Xn-1+0.0001)) to avoid |
---|
| 270 | * negative (1.+) and infinite values (+1.e-10) */ |
---|
| 271 | void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){ |
---|
[ec2fa2a] | 272 | uint_t i,j; |
---|
| 273 | for (i=0;i<fftgrain->channels;i++) { |
---|
| 274 | onset->data[i][0] = 0.; |
---|
| 275 | for (j=0;j<fftgrain->length;j++) { |
---|
| 276 | onset->data[i][0] += LOG(1.+fftgrain->norm[i][j]/(o->oldmag->data[i][j]+1.e-10)); |
---|
| 277 | o->oldmag->data[i][j] = fftgrain->norm[i][j]; |
---|
| 278 | } |
---|
| 279 | if (isnan(onset->data[i][0])) onset->data[i][0] = 0.; |
---|
| 280 | } |
---|
[b31f262] | 281 | } |
---|
| 282 | |
---|
[fabb7cd] | 283 | /* Spectral flux */ |
---|
| 284 | void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){ |
---|
| 285 | uint_t i, j; |
---|
| 286 | for (i=0;i<fftgrain->channels;i++) { |
---|
| 287 | onset->data[i][0] = 0.; |
---|
| 288 | for (j=0;j<fftgrain->length;j++) { |
---|
| 289 | if (fftgrain->norm[i][j] > o->oldmag->data[i][j]) |
---|
| 290 | onset->data[i][0] += fftgrain->norm[i][j] - o->oldmag->data[i][j]; |
---|
| 291 | o->oldmag->data[i][j] = fftgrain->norm[i][j]; |
---|
| 292 | } |
---|
| 293 | } |
---|
| 294 | } |
---|
| 295 | |
---|
[96fb8ad] | 296 | /* Generic function pointing to the choosen one */ |
---|
| 297 | void |
---|
| 298 | aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, |
---|
[ec2fa2a] | 299 | fvec_t * onset) { |
---|
| 300 | o->funcpointer(o,fftgrain,onset); |
---|
[96fb8ad] | 301 | } |
---|
| 302 | |
---|
[c621415] | 303 | /* Allocate memory for an onset detection |
---|
| 304 | * depending on the choosen type, allocate memory as needed |
---|
| 305 | */ |
---|
[96fb8ad] | 306 | aubio_onsetdetection_t * |
---|
| 307 | new_aubio_onsetdetection (aubio_onsetdetection_type type, |
---|
[ec2fa2a] | 308 | uint_t size, uint_t channels){ |
---|
| 309 | aubio_onsetdetection_t * o = AUBIO_NEW(aubio_onsetdetection_t); |
---|
| 310 | uint_t rsize = size/2+1; |
---|
[237f632] | 311 | uint_t i; |
---|
[ec2fa2a] | 312 | switch(type) { |
---|
| 313 | /* for both energy and hfc, only fftgrain->norm is required */ |
---|
| 314 | case aubio_onset_energy: |
---|
| 315 | break; |
---|
| 316 | case aubio_onset_hfc: |
---|
| 317 | break; |
---|
| 318 | /* the other approaches will need some more memory spaces */ |
---|
| 319 | case aubio_onset_complex: |
---|
| 320 | o->oldmag = new_fvec(rsize,channels); |
---|
| 321 | o->dev1 = new_fvec(rsize,channels); |
---|
| 322 | o->theta1 = new_fvec(rsize,channels); |
---|
| 323 | o->theta2 = new_fvec(rsize,channels); |
---|
| 324 | break; |
---|
| 325 | case aubio_onset_phase: |
---|
| 326 | o->dev1 = new_fvec(rsize,channels); |
---|
| 327 | o->theta1 = new_fvec(rsize,channels); |
---|
| 328 | o->theta2 = new_fvec(rsize,channels); |
---|
[acf7d30] | 329 | o->histog = new_aubio_hist(0.0, PI, 10, channels); |
---|
[ec2fa2a] | 330 | o->threshold = 0.1; |
---|
| 331 | break; |
---|
| 332 | case aubio_onset_specdiff: |
---|
| 333 | o->oldmag = new_fvec(rsize,channels); |
---|
| 334 | o->dev1 = new_fvec(rsize,channels); |
---|
[acf7d30] | 335 | o->histog = new_aubio_hist(0.0, PI, 10, channels); |
---|
[ec2fa2a] | 336 | o->threshold = 0.1; |
---|
| 337 | break; |
---|
| 338 | case aubio_onset_kl: |
---|
| 339 | case aubio_onset_mkl: |
---|
[fabb7cd] | 340 | case aubio_onset_specflux: |
---|
[ec2fa2a] | 341 | o->oldmag = new_fvec(rsize,channels); |
---|
| 342 | break; |
---|
| 343 | default: |
---|
| 344 | break; |
---|
| 345 | } |
---|
[96fb8ad] | 346 | |
---|
[ec2fa2a] | 347 | /* this switch could be in its own function to change between |
---|
| 348 | * detections on the fly. this would need getting rid of the switch |
---|
| 349 | * above and always allocate all the structure */ |
---|
| 350 | |
---|
| 351 | switch(type) { |
---|
| 352 | case aubio_onset_energy: |
---|
| 353 | o->funcpointer = aubio_onsetdetection_energy; |
---|
| 354 | break; |
---|
| 355 | case aubio_onset_hfc: |
---|
| 356 | o->funcpointer = aubio_onsetdetection_hfc; |
---|
| 357 | break; |
---|
| 358 | case aubio_onset_complex: |
---|
| 359 | o->funcpointer = aubio_onsetdetection_complex; |
---|
| 360 | break; |
---|
| 361 | case aubio_onset_phase: |
---|
| 362 | o->funcpointer = aubio_onsetdetection_phase; |
---|
| 363 | break; |
---|
| 364 | case aubio_onset_specdiff: |
---|
| 365 | o->funcpointer = aubio_onsetdetection_specdiff; |
---|
| 366 | break; |
---|
| 367 | case aubio_onset_kl: |
---|
| 368 | o->funcpointer = aubio_onsetdetection_kl; |
---|
| 369 | break; |
---|
| 370 | case aubio_onset_mkl: |
---|
| 371 | o->funcpointer = aubio_onsetdetection_mkl; |
---|
| 372 | break; |
---|
[fabb7cd] | 373 | case aubio_onset_specflux: |
---|
| 374 | o->funcpointer = aubio_onsetdetection_specflux; |
---|
| 375 | break; |
---|
[ec2fa2a] | 376 | default: |
---|
| 377 | break; |
---|
| 378 | } |
---|
| 379 | o->type = type; |
---|
| 380 | return o; |
---|
[96fb8ad] | 381 | } |
---|
| 382 | |
---|
[e9d8cfe] | 383 | void del_aubio_onsetdetection (aubio_onsetdetection_t *o){ |
---|
[ec2fa2a] | 384 | switch(o->type) { |
---|
| 385 | /* for both energy and hfc, only fftgrain->norm is required */ |
---|
| 386 | case aubio_onset_energy: |
---|
| 387 | break; |
---|
| 388 | case aubio_onset_hfc: |
---|
| 389 | break; |
---|
| 390 | /* the other approaches will need some more memory spaces */ |
---|
| 391 | case aubio_onset_complex: |
---|
| 392 | del_fvec(o->oldmag); |
---|
| 393 | del_fvec(o->dev1); |
---|
| 394 | del_fvec(o->theta1); |
---|
| 395 | del_fvec(o->theta2); |
---|
| 396 | break; |
---|
| 397 | case aubio_onset_phase: |
---|
| 398 | del_fvec(o->dev1); |
---|
| 399 | del_fvec(o->theta1); |
---|
| 400 | del_fvec(o->theta2); |
---|
| 401 | del_aubio_hist(o->histog); |
---|
| 402 | break; |
---|
| 403 | case aubio_onset_specdiff: |
---|
| 404 | del_fvec(o->oldmag); |
---|
| 405 | del_fvec(o->dev1); |
---|
| 406 | del_aubio_hist(o->histog); |
---|
| 407 | break; |
---|
| 408 | case aubio_onset_kl: |
---|
| 409 | case aubio_onset_mkl: |
---|
[e2da295] | 410 | case aubio_onset_specflux: |
---|
[ec2fa2a] | 411 | del_fvec(o->oldmag); |
---|
| 412 | break; |
---|
| 413 | default: |
---|
| 414 | break; |
---|
| 415 | } |
---|
| 416 | AUBIO_FREE(o); |
---|
[96fb8ad] | 417 | } |
---|