2 Copyright (C) 2003 Paul Brossier
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.
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.
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.
22 * Onset detection functions
24 * These functions are adapted from Juan Pablo Bello matlab code.
26 * - all of the following onset detection function take as arguments the fft of
27 * a windowed signal ( be created with an aubio_pvoc).
30 * (the phasevocoder implementation does implement an fftshift like)
32 * - they output one smpl_t per frame and per channel (stored in a fvec_t * of
35 * Some of the functions should be improved by - downsampling the input of the
36 * phasevocoder - oversampling the ouput
38 * \todo write a generic driver (with a phase vocoder and the appropriate
43 #ifndef ONSETDETECTION_H
44 #define ONSETDETECTION_H
50 /** onsetdetection types */
52 energy, /**< energy based */
53 specdiff, /**< spectral diff */
54 hfc, /**< high frequency content */
55 complexdomain, /**< complex domain */
56 phase /**< phase fast */
57 } aubio_onsetdetection_type;
59 /** onsetdetection structure */
60 typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t;
61 /** Energy based onset detection function
63 * calculates the local energy profile
68 void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
69 /** High Frequency Content onset detection function
74 void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
75 /** Complex Domain Method onset detection function
77 * From C. Duxbury & J. Pablo Bello
84 void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
85 /** Phase Based Method onset detection function
92 void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
93 /** Spectral difference method onset detection function
100 void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
101 /** Generic function pointing to the choosen one */
102 void aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
103 /** Allocate memory for an onset detection */
104 aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels);
105 /** Free memory for an onset detection */
106 void aubio_onsetdetection_free(aubio_onsetdetection_t *o);
112 #endif /* ONSETDETECTION_H */