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