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 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]).
28 These functions were first adapted from Juan Pablo Bello's code, and now
29 include further improvements and modifications made within aubio.
34 #ifndef ONSETDETECTION_H
35 #define ONSETDETECTION_H
41 /** onsetdetection types */
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 */
48 aubio_onset_kl, /**< Kullback Liebler */
49 aubio_onset_mkl, /**< modified Kullback Liebler */
50 } aubio_onsetdetection_type;
52 /** onsetdetection structure */
53 typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t;
54 /** Energy based onset detection function
56 This function calculates the local energy of the input spectral frame.
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
63 void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
64 /** High Frequency Content onset detection function
66 This method computes the High Frequency Content (HFC) of the input spectral
67 frame. The resulting function is efficient at detecting percussive onsets.
69 Paul Masri. Computer modeling of Sound for Transformation and Synthesis of
70 Musical Signal. PhD dissertation, University of Bristol, UK, 1996.
72 \param o onset detection object as returned by new_aubio_onsetdetection()
73 \param fftgrain input spectral frame
74 \param onset output onset detection function
77 void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
78 /** Complex Domain Method onset detection function
80 Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain
81 onset detection for musical signals. In Proceedings of the Digital Audio
82 Effects Conference, DAFx-03, pages 90-93, London, UK, 2003.
84 \param o onset detection object as returned by new_aubio_onsetdetection()
85 \param fftgrain input spectral frame
86 \param onset output onset detection function
89 void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
90 /** Phase Based Method onset detection function
92 Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset
93 detection for music signals. In Proceedings of the IEEE International
94 Conference on Acoustics Speech and Signal Processing, pages 441444,
97 \param o onset detection object as returned by new_aubio_onsetdetection()
98 \param fftgrain input spectral frame
99 \param onset output onset detection function
102 void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
103 /** Spectral difference method onset detection function
105 Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to
106 rhythm analysis. In IEEE International Conference on Multimedia and Expo
107 (ICME 2001), pages 881884, Tokyo, Japan, August 2001.
109 \param o onset detection object as returned by new_aubio_onsetdetection()
110 \param fftgrain input spectral frame
111 \param onset output onset detection function
114 void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
115 /** Kullback-Liebler onset detection function
117 Stephen Hainsworth and Malcom Macleod. Onset detection in music audio
118 signals. In Proceedings of the International Computer Music Conference
119 (ICMC), Singapore, 2003.
121 \param o onset detection object as returned by new_aubio_onsetdetection()
122 \param fftgrain input spectral frame
123 \param onset output onset detection function
126 void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
127 /** Modified Kullback-Liebler onset detection function
129 Paul Brossier, ``Automatic annotation of musical audio for interactive
130 systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital
131 music, Queen Mary University of London, London, UK, 2006.
133 \param o onset detection object as returned by new_aubio_onsetdetection()
134 \param fftgrain input spectral frame
135 \param onset output onset detection function
138 void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
139 /** execute onset detection function on a spectral frame
141 Generic function to compute onset detection.
143 \param o onset detection object as returned by new_aubio_onsetdetection()
144 \param fftgrain input signal spectrum as computed by aubio_pvoc_do
145 \param onset output vector (one sample long, to send to the peak picking)
148 void aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
149 /** creation of an onset detection object
151 \param type onset detection mode
152 \param size length of the input spectrum frame
153 \param channels number of input channels
156 aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels);
157 /** deletion of an onset detection object
159 \param o onset detection object as returned by new_aubio_onsetdetection()
162 void del_aubio_onsetdetection(aubio_onsetdetection_t *o);
168 #endif /* ONSETDETECTION_H */