source: src/onsetdetection.h @ 2e2bfff

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 2e2bfff was 5cf415f, checked in by Paul Brossier <piem@altern.org>, 19 years ago

protected onset enumerators, factorise python check_modes

  • Property mode set to 100644
File size: 4.0 KB
Line 
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 * These functions are adapted from Juan Pablo Bello matlab code.
25 *
26 * - all of the following onset detection function take as arguments the fft of
27 *   a windowed signal ( be created with an aubio_pvoc).
28 *
29 *
30 * (the phasevocoder implementation does implement an fftshift like)
31 *
32 * - they output one smpl_t per frame and per channel (stored in a fvec_t * of
33 *   size [channels][1])
34 *
35 *  Some of the functions should be improved by - downsampling the input of the
36 *  phasevocoder - oversampling the ouput
37 *
38 *  \todo write a generic driver (with a phase vocoder and the appropriate
39 *  resampling)
40 */
41
42
43#ifndef ONSETDETECTION_H
44#define ONSETDETECTION_H
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50/** onsetdetection types */
51typedef enum {
52        aubio_onset_energy,         /**< energy based */         
53        aubio_onset_specdiff,       /**< spectral diff */         
54        aubio_onset_hfc,            /**< high frequency content */
55        aubio_onset_complex,        /**< complex domain */       
56        aubio_onset_phase,          /**< phase fast */           
57        aubio_onset_kl,             /**< Kullback Liebler (Hainsworth et al.,  Onset detection in musical audio signals) */
58        aubio_onset_mkl             /**< modified Kullback Liebler (Hainsworth et al.,  Onset detection in musical audio signals) */
59} aubio_onsetdetection_type;
60
61/** onsetdetection structure */
62typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t;
63/** Energy based onset detection function
64 *
65 * calculates the local energy profile
66 *
67 *      - buffer 1024
68 *      - overlap 512
69 */
70void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
71/** High Frequency Content onset detection function
72 *
73 *      - buffer 1024
74 *      - overlap 512
75 */
76void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
77/** Complex Domain Method onset detection function
78 *
79 *      From C. Duxbury & J. Pablo Bello
80 *             
81 *      - buffer 512
82 *      - overlap 128
83 *      - dowfact 8
84 *      - interpfact 2
85 */
86void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
87/** Phase Based Method onset detection function
88 *
89 *      - buffer 512
90 *      - overlap 128
91 *      - dowfact 8
92 *      - interpfact 2
93 */
94void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
95/** Spectral difference method onset detection function
96 *
97 *      - buffer 512
98 *      - overlap 128
99 *      - dowfact 8
100 *      - interpfact 2
101 */
102void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
103/** Kullback-Liebler onset detection function */
104void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
105/** Modified Kullback-Liebler onset detection function */
106void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
107/** Generic function pointing to the choosen one */
108void aubio_onsetdetection(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
109/** Allocate memory for an onset detection */
110aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels);
111/** Free memory for an onset detection */
112void aubio_onsetdetection_free(aubio_onsetdetection_t *o);
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif /* ONSETDETECTION_H */
Note: See TracBrowser for help on using the repository browser.