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 | */ |
---|
32 | |
---|
33 | |
---|
34 | #ifndef ONSETDETECTION_H |
---|
35 | #define ONSETDETECTION_H |
---|
36 | |
---|
37 | #ifdef __cplusplus |
---|
38 | extern "C" { |
---|
39 | #endif |
---|
40 | |
---|
41 | /** onsetdetection types */ |
---|
42 | typedef enum { |
---|
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_onset_specflux, /**< spectral flux */ |
---|
51 | } aubio_onsetdetection_type; |
---|
52 | |
---|
53 | /** onsetdetection structure */ |
---|
54 | typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t; |
---|
55 | /** execute onset detection function on a spectral frame |
---|
56 | |
---|
57 | Generic function to compute onset detection. |
---|
58 | |
---|
59 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
60 | \param fftgrain input signal spectrum as computed by aubio_pvoc_do |
---|
61 | \param onset output vector (one sample long, to send to the peak picking) |
---|
62 | |
---|
63 | */ |
---|
64 | void aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset); |
---|
65 | /** creation of an onset detection object |
---|
66 | |
---|
67 | \param type onset detection mode |
---|
68 | \param size length of the input spectrum frame |
---|
69 | \param channels number of input channels |
---|
70 | |
---|
71 | */ |
---|
72 | aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels); |
---|
73 | /** deletion of an onset detection object |
---|
74 | |
---|
75 | \param o onset detection object as returned by new_aubio_onsetdetection() |
---|
76 | |
---|
77 | */ |
---|
78 | void del_aubio_onsetdetection(aubio_onsetdetection_t *o); |
---|
79 | |
---|
80 | #ifdef __cplusplus |
---|
81 | } |
---|
82 | #endif |
---|
83 | |
---|
84 | #endif /* ONSETDETECTION_H */ |
---|