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 | /** \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 | \todo Write a generic driver similar to pitchdetection.c, including the phase |
---|
32 | vocoder, the silence detection, and the peak picking. |
---|
33 | |
---|
34 | */ |
---|
35 | |
---|
36 | |
---|
37 | #ifndef ONSETDETECTION_H |
---|
38 | #define ONSETDETECTION_H |
---|
39 | |
---|
40 | #ifdef __cplusplus |
---|
41 | extern "C" { |
---|
42 | #endif |
---|
43 | |
---|
44 | /** onsetdetection types */ |
---|
45 | typedef enum { |
---|
46 | aubio_onset_energy, /**< energy based */ |
---|
47 | aubio_onset_specdiff, /**< spectral diff */ |
---|
48 | aubio_onset_hfc, /**< high frequency content */ |
---|
49 | aubio_onset_complex, /**< complex domain */ |
---|
50 | aubio_onset_phase, /**< phase fast */ |
---|
51 | aubio_onset_kl, /**< Kullback Liebler */ |
---|
52 | aubio_onset_mkl /**< modified Kullback Liebler */ |
---|
53 | } aubio_onsetdetection_type; |
---|
54 | |
---|
55 | /** onsetdetection structure */ |
---|
56 | typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t; |
---|
57 | /** Energy based onset detection function |
---|
58 | |
---|
59 | This function calculates the local energy of the input spectral frame. |
---|
60 | |
---|
61 | \param o onset detection object as returned by new_aubio_pitchfcomb |
---|
62 | \param fftgrain input spectral frame |
---|
63 | \param onset output onset detection function |
---|
64 | |
---|
65 | */ |
---|
66 | void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
67 | /** High Frequency Content onset detection function |
---|
68 | |
---|
69 | This method computes the High Frequency Content (HFC) of the input spectral |
---|
70 | frame. The resulting function is efficient at detecting percussive onsets. |
---|
71 | |
---|
72 | Paul Masri. Computer modeling of Sound for Transformation and Synthesis of |
---|
73 | Musical Signal. PhD dissertation, University of Bristol, UK, 1996. |
---|
74 | |
---|
75 | \param o onset detection object as returned by new_aubio_pitchfcomb |
---|
76 | \param fftgrain input spectral frame |
---|
77 | \param onset output onset detection function |
---|
78 | |
---|
79 | */ |
---|
80 | void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
81 | /** Complex Domain Method onset detection function |
---|
82 | |
---|
83 | Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain |
---|
84 | onset detection for musical signals. In Proceedings of the Digital Audio |
---|
85 | Effects Conference, DAFx-03, pages 9093, London, UK, 2003. |
---|
86 | |
---|
87 | \param o onset detection object as returned by new_aubio_pitchfcomb |
---|
88 | \param fftgrain input spectral frame |
---|
89 | \param onset output onset detection function |
---|
90 | |
---|
91 | */ |
---|
92 | void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
93 | /** Phase Based Method onset detection function |
---|
94 | |
---|
95 | Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset |
---|
96 | detection for music signals. In Proceedings of the IEEE International |
---|
97 | Conference on Acoustics Speech and Signal Processing, pages 441444, |
---|
98 | Hong-Kong, 2003. |
---|
99 | |
---|
100 | \param o onset detection object as returned by new_aubio_pitchfcomb |
---|
101 | \param fftgrain input spectral frame |
---|
102 | \param onset output onset detection function |
---|
103 | |
---|
104 | */ |
---|
105 | void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
106 | /** Spectral difference method onset detection function |
---|
107 | |
---|
108 | Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to |
---|
109 | rhythm analysis. In IEEE International Conference on Multimedia and Expo |
---|
110 | (ICME 2001), pages 881884, Tokyo, Japan, August 2001. |
---|
111 | |
---|
112 | \param o onset detection object as returned by new_aubio_pitchfcomb |
---|
113 | \param fftgrain input spectral frame |
---|
114 | \param onset output onset detection function |
---|
115 | |
---|
116 | */ |
---|
117 | void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
118 | /** Kullback-Liebler onset detection function |
---|
119 | |
---|
120 | Stephen Hainsworth and Malcom Macleod. Onset detection in music audio |
---|
121 | signals. In Proceedings of the International Computer Music Conference |
---|
122 | (ICMC), Singapore, 2003. |
---|
123 | |
---|
124 | \param o onset detection object as returned by new_aubio_pitchfcomb |
---|
125 | \param fftgrain input spectral frame |
---|
126 | \param onset output onset detection function |
---|
127 | |
---|
128 | */ |
---|
129 | void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
130 | /** Modified Kullback-Liebler onset detection function |
---|
131 | |
---|
132 | Paul Brossier, ``Automatic annotation of musical audio for interactive |
---|
133 | systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital |
---|
134 | music, Queen Mary University of London, London, UK, 2003. |
---|
135 | |
---|
136 | \param o onset detection object as returned by new_aubio_pitchfcomb |
---|
137 | \param fftgrain input spectral frame |
---|
138 | \param onset output onset detection function |
---|
139 | |
---|
140 | */ |
---|
141 | void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
142 | /** execute onset detection function on a spectral frame |
---|
143 | |
---|
144 | Generic function to compute onset detection. |
---|
145 | |
---|
146 | \param o onset detection object as returned by new_aubio_onsetdetection |
---|
147 | \param fftgrain input signal spectrum as computed by aubio_pvoc_do |
---|
148 | \param onset output vector (one sample long, to send to the peak picking) |
---|
149 | |
---|
150 | */ |
---|
151 | void aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
152 | /** creation of an onset detection object |
---|
153 | |
---|
154 | \param type onset detection mode |
---|
155 | \param size length of the input spectrum frame |
---|
156 | \param channels number of input channels |
---|
157 | |
---|
158 | */ |
---|
159 | aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels); |
---|
160 | /** deletion of an onset detection object |
---|
161 | |
---|
162 | \param o onset detection object as returned by new_aubio_pitchfcomb |
---|
163 | |
---|
164 | */ |
---|
165 | void aubio_onsetdetection_free(aubio_onsetdetection_t *o); |
---|
166 | |
---|
167 | #ifdef __cplusplus |
---|
168 | } |
---|
169 | #endif |
---|
170 | |
---|
171 | #endif /* ONSETDETECTION_H */ |
---|