andrew@0
|
1 /*
|
andrew@0
|
2 Copyright (C) 2006 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 driver
|
andrew@0
|
23
|
andrew@0
|
24 The following routines compute the onset detection function and detect peaks
|
andrew@0
|
25 in these functions. When onsets are found above a given silence threshold,
|
andrew@0
|
26 and after a minimum inter-onset interval, the output vector returned by
|
andrew@0
|
27 aubio_onset is filled with 1. Otherwise, the output vector remains 0.
|
andrew@0
|
28
|
andrew@0
|
29 The peak-picking threshold, the silence threshold, and the minimum
|
andrew@0
|
30 inter-onset interval can be adjusted during the execution of the aubio_onset
|
andrew@0
|
31 routine using the corresponding functions.
|
andrew@0
|
32
|
andrew@0
|
33 */
|
andrew@0
|
34
|
andrew@0
|
35
|
andrew@0
|
36 #ifndef ONSET_H
|
andrew@0
|
37 #define ONSET_H
|
andrew@0
|
38
|
andrew@0
|
39 #ifdef __cplusplus
|
andrew@0
|
40 extern "C" {
|
andrew@0
|
41 #endif
|
andrew@0
|
42
|
andrew@0
|
43 /** onset detection object */
|
andrew@0
|
44 typedef struct _aubio_onset_t aubio_onset_t;
|
andrew@0
|
45
|
andrew@0
|
46 /** create onset detection object
|
andrew@0
|
47
|
andrew@0
|
48 \param type_onset onset detection type as specified in onsetdetection.h
|
andrew@0
|
49 \param buf_size buffer size for phase vocoder
|
andrew@0
|
50 \param hop_size hop size for phase vocoder
|
andrew@0
|
51 \param channels number of channels
|
andrew@0
|
52
|
andrew@0
|
53 */
|
andrew@0
|
54 aubio_onset_t * new_aubio_onset (aubio_onsetdetection_type type_onset,
|
andrew@0
|
55 ba_uint_t buf_size, ba_uint_t hop_size, ba_uint_t channels);
|
andrew@0
|
56
|
andrew@0
|
57 /** execute onset detection
|
andrew@0
|
58
|
andrew@0
|
59 \param o onset detection object as returned by new_aubio_onset
|
andrew@0
|
60 \param input new audio vector of length hop_size
|
andrew@0
|
61 \param onset output vector, 1 if onset is found, 0 otherwise
|
andrew@0
|
62
|
andrew@0
|
63 */
|
andrew@0
|
64 void aubio_onset(aubio_onset_t *o, fvec_t * input, fvec_t * onset);
|
andrew@0
|
65
|
andrew@0
|
66 /** set onset detection silence threshold
|
andrew@0
|
67
|
andrew@0
|
68 \param o onset detection object as returned by new_aubio_onset
|
andrew@0
|
69 \param silence new silence detection threshold
|
andrew@0
|
70
|
andrew@0
|
71 */
|
andrew@0
|
72 void aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence);
|
andrew@0
|
73
|
andrew@0
|
74 /** set onset detection peak picking threshold
|
andrew@0
|
75
|
andrew@0
|
76 \param o onset detection object as returned by new_aubio_onset
|
andrew@0
|
77 \param threshold new peak-picking threshold
|
andrew@0
|
78
|
andrew@0
|
79 */
|
andrew@0
|
80 void aubio_onset_set_threshold(aubio_onset_t * o, smpl_t threshold);
|
andrew@0
|
81
|
andrew@0
|
82 /** set minimum inter onset interval
|
andrew@0
|
83
|
andrew@0
|
84 \param o onset detection object as returned by new_aubio_onset
|
andrew@0
|
85 \param minioi minimum number of frames between onsets (in multiple of
|
andrew@0
|
86 hop_size/samplerare)
|
andrew@0
|
87
|
andrew@0
|
88 */
|
andrew@0
|
89 void aubio_onset_set_minioi(aubio_onset_t * o, ba_uint_t minioi);
|
andrew@0
|
90
|
andrew@0
|
91 /** delete onset detection object
|
andrew@0
|
92
|
andrew@0
|
93 \param o onset detection object to delete
|
andrew@0
|
94
|
andrew@0
|
95 */
|
andrew@0
|
96 void del_aubio_onset(aubio_onset_t * o);
|
andrew@0
|
97
|
andrew@0
|
98 #ifdef __cplusplus
|
andrew@0
|
99 }
|
andrew@0
|
100 #endif
|
andrew@0
|
101
|
andrew@0
|
102 #endif /* ONSET_H */
|