source: src/onset/onset.h @ 479adba

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 479adba was 479adba, checked in by Paul Brossier <piem@piem.org>, 10 years ago

src/onset/onset.h: improve documentation

  • Property mode set to 100644
File size: 7.6 KB
RevLine 
[7524d0b]1/*
[e6a78ea]2  Copyright (C) 2006-2009 Paul Brossier <piem@aubio.org>
[7524d0b]3
[e6a78ea]4  This file is part of aubio.
[7524d0b]5
[e6a78ea]6  aubio is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
[7524d0b]10
[e6a78ea]11  aubio is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15
16  You should have received a copy of the GNU General Public License
17  along with aubio.  If not, see <http://www.gnu.org/licenses/>.
[7524d0b]18
19*/
20
[895ad8c]21/** \file
[35f73b8c]22
[69b11d8]23  Onset detection object
[895ad8c]24
25  The following routines compute the onset detection function and detect peaks
26  in these functions. When onsets are found above a given silence threshold,
27  and after a minimum inter-onset interval, the output vector returned by
[479adba]28  aubio_onset_do() is filled with `1`. Otherwise, the output vector remains
[69b11d8]29  `0`.
[895ad8c]30
31  The peak-picking threshold, the silence threshold, and the minimum
[a72f3f1]32  inter-onset interval can be adjusted during the execution of the
33  aubio_onset_do routine using the corresponding functions.
[895ad8c]34
[69b11d8]35  \example onset/test-onset.c
36
[895ad8c]37*/
[0e5326d]38
[895ad8c]39
[7524d0b]40#ifndef ONSET_H
41#define ONSET_H
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
[895ad8c]47/** onset detection object */
[7524d0b]48typedef struct _aubio_onset_t aubio_onset_t;
49
[895ad8c]50/** create onset detection object
[35f73b8c]51
[3ac7cb0]52  \param method onset detection type as specified in specdesc.h
[895ad8c]53  \param buf_size buffer size for phase vocoder
54  \param hop_size hop size for phase vocoder
[35f73b8c]55  \param samplerate sampling rate of the input signal
[895ad8c]56
[479adba]57  \return newly created ::aubio_onset_t
58
[895ad8c]59*/
[35f73b8c]60aubio_onset_t * new_aubio_onset (char_t * method,
[0b9a02a]61    uint_t buf_size, uint_t hop_size, uint_t samplerate);
[7524d0b]62
[895ad8c]63/** execute onset detection
64
[479adba]65  \param o onset detection object as returned by new_aubio_onset()
[895ad8c]66  \param input new audio vector of length hop_size
[35f73b8c]67  \param onset output vector of length 1, containing 0 if no onset was found,
68  and a value equal or greater than 1 otherwise
69
70  When no onset was detected, the first element of the output vector `onset`
71  is set to 0.
72
73  When an onset is found, the first element of the output vector `onset` is set
74  to `offset = 1 + a` where `a` is a number in the range`[0, 1]`.
75
76  The final onset detection time, in samples, can be obtained with
[479adba]77  aubio_onset_get_last(). It can also be derived from `offset` as
[35f73b8c]78  follows:
79
80  \code
81    t = total_frames + offset * hop_size - delay
82  \endcode
83
84  where `total_frames` is the total number of frames processed so far, and
85  `delay` is the current delay of the onset object, as returned by
[479adba]86  aubio_onset_get_delay().
[895ad8c]87
88*/
[a72f3f1]89void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset);
[7524d0b]90
[f5e0a54]91/** get the time of the latest onset detected, in samples
92
[479adba]93  \param o onset detection object as returned by new_aubio_onset()
94
95  \return onset detection timestamps (in samples)
[f5e0a54]96
97*/
[8b884ef]98uint_t aubio_onset_get_last (aubio_onset_t *o);
[f5e0a54]99
100/** get the time of the latest onset detected, in seconds
101
[479adba]102  \param o onset detection object as returned by new_aubio_onset()
103
104  \return onset detection timestamps (in seconds)
[f5e0a54]105
106*/
[8b884ef]107smpl_t aubio_onset_get_last_s (aubio_onset_t *o);
[f5e0a54]108
109/** get the time of the latest onset detected, in milliseconds
110
[479adba]111  \param o onset detection object as returned by new_aubio_onset()
112
113  \return onset detection timestamps (in milliseconds)
[f5e0a54]114
115*/
[8b884ef]116smpl_t aubio_onset_get_last_ms (aubio_onset_t *o);
[f5e0a54]117
[895ad8c]118/** set onset detection silence threshold
119
[479adba]120  \param o onset detection object as returned by new_aubio_onset()
[895ad8c]121  \param silence new silence detection threshold
122
123*/
[6338636]124uint_t aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence);
[7524d0b]125
[ae81726]126/** get onset detection function
127
[479adba]128  \param o onset detection object as returned by new_aubio_onset()
[ae81726]129  \return the current value of the descriptor
130
131*/
132smpl_t aubio_onset_get_descriptor ( aubio_onset_t *o);
133
134/** get thresholded onset detection function
135
[479adba]136  \param o onset detection object as returned by new_aubio_onset()
[ae81726]137  \return the value of the thresholded descriptor
138
139*/
140smpl_t aubio_onset_get_thresholded_descriptor ( aubio_onset_t *o);
141
[35f73b8c]142/** set onset detection peak picking threshold
[895ad8c]143
[479adba]144  \param o onset detection object as returned by new_aubio_onset()
[895ad8c]145  \param threshold new peak-picking threshold
146
147*/
[6338636]148uint_t aubio_onset_set_threshold(aubio_onset_t * o, smpl_t threshold);
[7524d0b]149
[35f73b8c]150/** set minimum inter onset interval in samples
[895ad8c]151
[479adba]152  \param o onset detection object as returned by new_aubio_onset()
[0bbdbfd]153  \param minioi minimum interval between two consecutive onsets (in
[35f73b8c]154  samples)
[895ad8c]155
156*/
[6338636]157uint_t aubio_onset_set_minioi(aubio_onset_t * o, uint_t minioi);
[7524d0b]158
[35f73b8c]159/** set minimum inter onset interval in seconds
160
[479adba]161  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]162  \param minioi minimum interval between two consecutive onsets (in
163  seconds)
164
165*/
166uint_t aubio_onset_set_minioi_s(aubio_onset_t * o, smpl_t minioi);
167
168/** set minimum inter onset interval in milliseconds
169
[479adba]170  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]171  \param minioi minimum interval between two consecutive onsets (in
172  milliseconds)
173
174*/
175uint_t aubio_onset_set_minioi_ms(aubio_onset_t * o, smpl_t minioi);
176
177/** set minimum inter onset interval in samples
178
[479adba]179  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]180  \param delay constant system delay to take back from detection time
181  (in samples)
182
183*/
184uint_t aubio_onset_set_delay(aubio_onset_t * o, uint_t delay);
185
186/** set minimum inter onset interval in seconds
187
[479adba]188  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]189  \param delay constant system delay to take back from detection time
190  (in seconds)
191
192*/
193uint_t aubio_onset_set_delay_s(aubio_onset_t * o, smpl_t delay);
194
195/** set minimum inter onset interval in milliseconds
196
[479adba]197  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]198  \param delay constant system delay to take back from detection time
199  (in milliseconds)
200
201*/
202uint_t aubio_onset_set_delay_ms(aubio_onset_t * o, smpl_t delay);
203
204/** get minimum inter onset interval in samples
205
[479adba]206  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]207  \return minimum interval between two consecutive onsets (in
208  samples)
209
210*/
211uint_t aubio_onset_get_minioi(aubio_onset_t * o);
212
213/** get minimum inter onset interval in seconds
214
[479adba]215  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]216  \return minimum interval between two consecutive onsets (in
217  seconds)
218
219*/
220smpl_t aubio_onset_get_minioi_s(aubio_onset_t * o);
221
222/** get minimum inter onset interval in milliseconds
223
[479adba]224  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]225  \return minimum interval between two consecutive onsets (in
226  milliseconds)
227
228*/
229smpl_t aubio_onset_get_minioi_ms(aubio_onset_t * o);
230
231/** get minimum inter onset interval in samples
232
[479adba]233  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]234  \return constant system delay to take back from detection time
235  (in samples)
236
237*/
238uint_t aubio_onset_get_delay(aubio_onset_t * o);
239
240/** get minimum inter onset interval in seconds
241
[479adba]242  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]243  \return constant system delay to take back from detection time
244  (in seconds)
245
246*/
247smpl_t aubio_onset_get_delay_s(aubio_onset_t * o);
248
249/** get minimum inter onset interval in milliseconds
250
[479adba]251  \param o onset detection object as returned by new_aubio_onset()
[35f73b8c]252  \return constant system delay to take back from detection time
253  (in milliseconds)
254
255*/
256smpl_t aubio_onset_get_delay_ms(aubio_onset_t * o);
257
[895ad8c]258/** delete onset detection object
259
[35f73b8c]260  \param o onset detection object to delete
[895ad8c]261
262*/
[7524d0b]263void del_aubio_onset(aubio_onset_t * o);
264
265#ifdef __cplusplus
266}
267#endif
268
269#endif /* ONSET_H */
Note: See TracBrowser for help on using the repository browser.