History

src/spectral/specdesc.{c,h}: rename aubio_onsetdetection to aubio_specdesc

Paul Brossier committed 17 years ago

Commit 31907fd1 parent bafe71d9 files · +94 −94Browse files

Unified · Split

9 files
  1. python/aubio/aubioclass.py +5 −5
  2. src/Makefile.am +1 −1
  3. src/aubio.h +1 −1
  4. src/onset/onset.c +7 −7
  5. src/onset/onset.h +1 −1
  6. src/spectral/specdesc.c +44 −44
  7. src/spectral/specdesc.h +6 −6
  8. src/tempo/tempo.c +7 −7
  9. tests/src/test-onsetdetection.c +22 −22
python/aubio/aubioclass.py+5−5
@@ -68,13 +68,13 @@ class pvoc: · 67 unmodified lines
68 aubio_pvoc_rdo(self.pv,tc(),tf())68 aubio_pvoc_rdo(self.pv,tc(),tf())
69 69
70class onsetdetection:70class onsetdetection:
71 """ class for aubio_onsetdetection """71 """ class for aubio_specdesc """
72 def __init__(self,mode,buf,chan):72 def __init__(self,mode,buf,chan):
73 self.od = new_aubio_onsetdetection(mode,buf,chan)73 self.od = new_aubio_specdesc(mode,buf,chan)
74 def do(self,tc,tf):74 def do(self,tc,tf):
75 aubio_onsetdetection_do(self.od,tc(),tf())75 aubio_specdesc_do(self.od,tc(),tf())
76 def __del__(self):76 def __del__(self):
77 del_aubio_onsetdetection(self.od)77 del_aubio_specdesc(self.od)
78 78
79class peakpick:79class peakpick:
80 """ class for aubio_peakpicker """80 """ class for aubio_peakpicker """
@@ -91,7 +91,7 @@ class peakpick: · 10 unmodified lines
91 del_aubio_peakpicker(self.pp)91 del_aubio_peakpicker(self.pp)
92 92
93class onsetpick:93class onsetpick:
94 """ superclass for aubio_pvoc + aubio_onsetdetection + aubio_peakpicker """94 """ superclass for aubio_pvoc + aubio_specdesc + aubio_peakpicker """
95 def __init__(self,bufsize,hopsize,channels,myvec,threshold,mode='dual',derivate=False,dcthreshold=0):95 def __init__(self,bufsize,hopsize,channels,myvec,threshold,mode='dual',derivate=False,dcthreshold=0):
96 self.myfft = cvec(bufsize,channels)96 self.myfft = cvec(bufsize,channels)
97 self.pv = pvoc(bufsize,hopsize,channels)97 self.pv = pvoc(bufsize,hopsize,channels)
src/Makefile.am+1−1
@@ -22,6 +22,7 @@ nobase_pkginclude_HEADERS = \ · 21 unmodified lines
22 spectral/phasevoc.h \22 spectral/phasevoc.h \
23 spectral/fft.h \23 spectral/fft.h \
24 spectral/tss.h \24 spectral/tss.h \
25 spectral/specdesc.h \
25 spectral/spectral_centroid.h \26 spectral/spectral_centroid.h \
26 pitch/pitch.h \27 pitch/pitch.h \
27 pitch/pitchmcomb.h \28 pitch/pitchmcomb.h \
@@ -30,7 +31,6 @@ nobase_pkginclude_HEADERS = \ · 2 unmodified lines
30 pitch/pitchfcomb.h \31 pitch/pitchfcomb.h \
31 pitch/pitchyinfft.h \32 pitch/pitchyinfft.h \
32 onset/onset.h \33 onset/onset.h \
33 onset/onsetdetection.h \
34 onset/peakpick.h \34 onset/peakpick.h \
35 tempo/tempo.h \35 tempo/tempo.h \
36 tempo/beattracking.h36 tempo/beattracking.h
src/aubio.h+1−1
@@ -165,6 +165,7 @@ extern "C" · 164 unmodified lines
165#include "spectral/fft.h"165#include "spectral/fft.h"
166#include "spectral/phasevoc.h"166#include "spectral/phasevoc.h"
167#include "spectral/mfcc.h"167#include "spectral/mfcc.h"
168#include "spectral/specdesc.h"
168#include "pitch/pitch.h"169#include "pitch/pitch.h"
169#include "onset/onset.h"170#include "onset/onset.h"
170#include "tempo/tempo.h"171#include "tempo/tempo.h"
@@ -182,7 +183,6 @@ extern "C" · 11 unmodified lines
182#include "pitch/pitchyinfft.h"183#include "pitch/pitchyinfft.h"
183#include "pitch/pitchschmitt.h"184#include "pitch/pitchschmitt.h"
184#include "pitch/pitchfcomb.h"185#include "pitch/pitchfcomb.h"
185#include "onset/onsetdetection.h"
186#include "spectral/spectral_centroid.h"186#include "spectral/spectral_centroid.h"
187#include "onset/peakpick.h"187#include "onset/peakpick.h"
188#include "tempo/beattracking.h"188#include "tempo/beattracking.h"
src/onset/onset.c+7−7
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#include "aubio_priv.h"21#include "aubio_priv.h"
22#include "fvec.h"22#include "fvec.h"
23#include "cvec.h"23#include "cvec.h"
24#include "onset/onsetdetection.h"24#include "spectral/specdesc.h"
25#include "spectral/phasevoc.h"25#include "spectral/phasevoc.h"
26#include "onset/peakpick.h"26#include "onset/peakpick.h"
27#include "mathutils.h"27#include "mathutils.h"
@@ -30,7 +30,7 @@ · 2 unmodified lines
30/** structure to store object state */30/** structure to store object state */
31struct _aubio_onset_t {31struct _aubio_onset_t {
32 aubio_pvoc_t * pv; /**< phase vocoder */32 aubio_pvoc_t * pv; /**< phase vocoder */
33 aubio_onsetdetection_t * od; /**< onset detection */ 33 aubio_specdesc_t * od; /**< onset detection */
34 aubio_peakpicker_t * pp; /**< peak picker */34 aubio_peakpicker_t * pp; /**< peak picker */
35 cvec_t * fftgrain; /**< phase vocoder output */35 cvec_t * fftgrain; /**< phase vocoder output */
36 fvec_t * of; /**< onset detection function */36 fvec_t * of; /**< onset detection function */
@@ -48,9 +48,9 @@ void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset) · 11 unmodified lines
48 smpl_t wasonset = 0;48 smpl_t wasonset = 0;
49 uint_t i;49 uint_t i;
50 aubio_pvoc_do (o->pv,input, o->fftgrain);50 aubio_pvoc_do (o->pv,input, o->fftgrain);
51 aubio_onsetdetection_do (o->od,o->fftgrain, o->of);51 aubio_specdesc_do (o->od,o->fftgrain, o->of);
52 /*if (usedoubled) {52 /*if (usedoubled) {
53 aubio_onsetdetection_do (o2,fftgrain, onset2);53 aubio_specdesc_do (o2,fftgrain, onset2);
54 onset->data[0][0] *= onset2->data[0][0];54 onset->data[0][0] *= onset2->data[0][0];
55 }*/55 }*/
56 aubio_peakpicker_do(o->pp, o->of, onset);56 aubio_peakpicker_do(o->pp, o->of, onset);
@@ -108,11 +108,11 @@ aubio_onset_t * new_aubio_onset (char_t * onset_mode, · 51 unmodified lines
108 o->pv = new_aubio_pvoc(buf_size, hop_size, channels);108 o->pv = new_aubio_pvoc(buf_size, hop_size, channels);
109 o->pp = new_aubio_peakpicker(channels);109 o->pp = new_aubio_peakpicker(channels);
110 aubio_peakpicker_set_threshold (o->pp, o->threshold);110 aubio_peakpicker_set_threshold (o->pp, o->threshold);
111 o->od = new_aubio_onsetdetection(onset_mode,buf_size,channels);111 o->od = new_aubio_specdesc(onset_mode,buf_size,channels);
112 o->fftgrain = new_cvec(buf_size,channels);112 o->fftgrain = new_cvec(buf_size,channels);
113 o->of = new_fvec(1, channels);113 o->of = new_fvec(1, channels);
114 /*if (usedoubled) {114 /*if (usedoubled) {
115 o2 = new_aubio_onsetdetection(onset_type2,buffer_size,channels);115 o2 = new_aubio_specdesc(onset_type2,buffer_size,channels);
116 onset2 = new_fvec(1 , channels);116 onset2 = new_fvec(1 , channels);
117 }*/117 }*/
118 return o;118 return o;
@@ -120,7 +120,7 @@ aubio_onset_t * new_aubio_onset (char_t * onset_mode, · 1 unmodified line
120 120
121void del_aubio_onset (aubio_onset_t *o)121void del_aubio_onset (aubio_onset_t *o)
122{122{
123 del_aubio_onsetdetection(o->od);123 del_aubio_specdesc(o->od);
124 del_aubio_peakpicker(o->pp);124 del_aubio_peakpicker(o->pp);
125 del_aubio_pvoc(o->pv);125 del_aubio_pvoc(o->pv);
126 del_fvec(o->of);126 del_fvec(o->of);
src/onset/onset.h+1−1
@@ -46,7 +46,7 @@ typedef struct _aubio_onset_t aubio_onset_t; · 45 unmodified lines
46 46
47/** create onset detection object47/** create onset detection object
48 48
49 \param onset_mode onset detection type as specified in onsetdetection.h49 \param onset_mode onset detection type as specified in specdesc.h
50 \param buf_size buffer size for phase vocoder50 \param buf_size buffer size for phase vocoder
51 \param hop_size hop size for phase vocoder51 \param hop_size hop size for phase vocoder
52 \param channels number of channels 52 \param channels number of channels
src/spectral/specdesc.crenamed from src/onset/onsetdetection.c+44−44
@@ -22,20 +22,20 @@ · 21 unmodified lines
22#include "fvec.h"22#include "fvec.h"
23#include "cvec.h"23#include "cvec.h"
24#include "spectral/fft.h"24#include "spectral/fft.h"
25#include "spectral/specdesc.h"
25#include "mathutils.h"26#include "mathutils.h"
26#include "utils/hist.h"27#include "utils/hist.h"
27#include "onset/onsetdetection.h"
28 28
29/** Energy based onset detection function 29/** Energy based onset detection function
30 30
31 This function calculates the local energy of the input spectral frame.31 This function calculates the local energy of the input spectral frame.
32 32
33 \param o onset detection object as returned by new_aubio_onsetdetection()33 \param o onset detection object as returned by new_aubio_specdesc()
34 \param fftgrain input spectral frame34 \param fftgrain input spectral frame
35 \param onset output onset detection function35 \param onset output onset detection function
36 36
37*/37*/
38void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);38void aubio_specdesc_energy(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
39/** High Frequency Content onset detection function39/** High Frequency Content onset detection function
40 40
41 This method computes the High Frequency Content (HFC) of the input spectral41 This method computes the High Frequency Content (HFC) of the input spectral
@@ -44,24 +44,24 @@ void aubio_onsetdetection_energy(aubio_onsetdetection_t *o, cvec_t * fftgrain, f · 2 unmodified lines
44 Paul Masri. Computer modeling of Sound for Transformation and Synthesis of44 Paul Masri. Computer modeling of Sound for Transformation and Synthesis of
45 Musical Signal. PhD dissertation, University of Bristol, UK, 1996.45 Musical Signal. PhD dissertation, University of Bristol, UK, 1996.
46 46
47 \param o onset detection object as returned by new_aubio_onsetdetection()47 \param o onset detection object as returned by new_aubio_specdesc()
48 \param fftgrain input spectral frame48 \param fftgrain input spectral frame
49 \param onset output onset detection function49 \param onset output onset detection function
50 50
51*/51*/
52void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);52void aubio_specdesc_hfc(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
53/** Complex Domain Method onset detection function 53/** Complex Domain Method onset detection function
54 54
55 Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain55 Christopher Duxbury, Mike E. Davies, and Mark B. Sandler. Complex domain
56 onset detection for musical signals. In Proceedings of the Digital Audio56 onset detection for musical signals. In Proceedings of the Digital Audio
57 Effects Conference, DAFx-03, pages 90-93, London, UK, 2003.57 Effects Conference, DAFx-03, pages 90-93, London, UK, 2003.
58 58
59 \param o onset detection object as returned by new_aubio_onsetdetection()59 \param o onset detection object as returned by new_aubio_specdesc()
60 \param fftgrain input spectral frame60 \param fftgrain input spectral frame
61 \param onset output onset detection function61 \param onset output onset detection function
62 62
63*/63*/
64void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);64void aubio_specdesc_complex(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
65/** Phase Based Method onset detection function 65/** Phase Based Method onset detection function
66 66
67 Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset67 Juan-Pablo Bello, Mike P. Davies, and Mark B. Sandler. Phase-based note onset
@@ -69,60 +69,60 @@ void aubio_onsetdetection_complex(aubio_onsetdetection_t *o, cvec_t * fftgrain, · 1 unmodified line
69 Conference on Acoustics Speech and Signal Processing, pages 441­444,69 Conference on Acoustics Speech and Signal Processing, pages 441­444,
70 Hong-Kong, 2003.70 Hong-Kong, 2003.
71 71
72 \param o onset detection object as returned by new_aubio_onsetdetection()72 \param o onset detection object as returned by new_aubio_specdesc()
73 \param fftgrain input spectral frame73 \param fftgrain input spectral frame
74 \param onset output onset detection function74 \param onset output onset detection function
75 75
76*/76*/
77void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);77void aubio_specdesc_phase(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
78/** Spectral difference method onset detection function 78/** Spectral difference method onset detection function
79 79
80 Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to80 Jonhatan Foote and Shingo Uchihashi. The beat spectrum: a new approach to
81 rhythm analysis. In IEEE International Conference on Multimedia and Expo81 rhythm analysis. In IEEE International Conference on Multimedia and Expo
82 (ICME 2001), pages 881­884, Tokyo, Japan, August 2001.82 (ICME 2001), pages 881­884, Tokyo, Japan, August 2001.
83 83
84 \param o onset detection object as returned by new_aubio_onsetdetection()84 \param o onset detection object as returned by new_aubio_specdesc()
85 \param fftgrain input spectral frame85 \param fftgrain input spectral frame
86 \param onset output onset detection function86 \param onset output onset detection function
87 87
88*/88*/
89void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);89void aubio_specdesc_specdiff(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
90/** Kullback-Liebler onset detection function 90/** Kullback-Liebler onset detection function
91 91
92 Stephen Hainsworth and Malcom Macleod. Onset detection in music audio92 Stephen Hainsworth and Malcom Macleod. Onset detection in music audio
93 signals. In Proceedings of the International Computer Music Conference93 signals. In Proceedings of the International Computer Music Conference
94 (ICMC), Singapore, 2003.94 (ICMC), Singapore, 2003.
95 95
96 \param o onset detection object as returned by new_aubio_onsetdetection()96 \param o onset detection object as returned by new_aubio_specdesc()
97 \param fftgrain input spectral frame97 \param fftgrain input spectral frame
98 \param onset output onset detection function98 \param onset output onset detection function
99 99
100*/100*/
101void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);101void aubio_specdesc_kl(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
102/** Modified Kullback-Liebler onset detection function 102/** Modified Kullback-Liebler onset detection function
103 103
104 Paul Brossier, ``Automatic annotation of musical audio for interactive104 Paul Brossier, ``Automatic annotation of musical audio for interactive
105 systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital105 systems'', Chapter 2, Temporal segmentation, PhD thesis, Centre for Digital
106 music, Queen Mary University of London, London, UK, 2006.106 music, Queen Mary University of London, London, UK, 2006.
107 107
108 \param o onset detection object as returned by new_aubio_onsetdetection()108 \param o onset detection object as returned by new_aubio_specdesc()
109 \param fftgrain input spectral frame109 \param fftgrain input spectral frame
110 \param onset output onset detection function110 \param onset output onset detection function
111 111
112*/112*/
113void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);113void aubio_specdesc_mkl(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
114/** Spectral Flux 114/** Spectral Flux
115 115
116 Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th116 Simon Dixon, Onset Detection Revisited, in ``Proceedings of the 9th
117 International Conference on Digital Audio Effects'' (DAFx-06), Montreal,117 International Conference on Digital Audio Effects'' (DAFx-06), Montreal,
118 Canada, 2006. 118 Canada, 2006.
119 119
120 \param o onset detection object as returned by new_aubio_onsetdetection()120 \param o onset detection object as returned by new_aubio_specdesc()
121 \param fftgrain input spectral frame121 \param fftgrain input spectral frame
122 \param onset output onset detection function122 \param onset output onset detection function
123 123
124*/124*/
125void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);125void aubio_specdesc_specflux(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
126 126
127/** onsetdetection types */127/** onsetdetection types */
128typedef enum {128typedef enum {
@@ -135,13 +135,13 @@ typedef enum { · 6 unmodified lines
135 aubio_onset_mkl, /**< modified Kullback Liebler */135 aubio_onset_mkl, /**< modified Kullback Liebler */
136 aubio_onset_specflux, /**< spectral flux */136 aubio_onset_specflux, /**< spectral flux */
137 aubio_onset_default = aubio_onset_hfc, /**< default mode, set to hfc */137 aubio_onset_default = aubio_onset_hfc, /**< default mode, set to hfc */
138} aubio_onsetdetection_type;138} aubio_specdesc_type;
139 139
140/** structure to store object state */140/** structure to store object state */
141struct _aubio_onsetdetection_t {141struct _aubio_specdesc_t {
142 aubio_onsetdetection_type onset_type; /**< onset detection type */142 aubio_specdesc_type onset_type; /**< onset detection type */
143 /** Pointer to aubio_onsetdetection_<type> function */143 /** Pointer to aubio_specdesc_<type> function */
144 void (*funcpointer)(aubio_onsetdetection_t *o,144 void (*funcpointer)(aubio_specdesc_t *o,
145 cvec_t * fftgrain, fvec_t * onset);145 cvec_t * fftgrain, fvec_t * onset);
146 smpl_t threshold; /**< minimum norm threshold for phase and specdiff */146 smpl_t threshold; /**< minimum norm threshold for phase and specdiff */
147 fvec_t *oldmag; /**< previous norm vector */147 fvec_t *oldmag; /**< previous norm vector */
@@ -153,7 +153,7 @@ struct _aubio_onsetdetection_t { · 5 unmodified lines
153 153
154 154
155/* Energy based onset detection function */155/* Energy based onset detection function */
156void aubio_onsetdetection_energy (aubio_onsetdetection_t *o UNUSED,156void aubio_specdesc_energy (aubio_specdesc_t *o UNUSED,
157 cvec_t * fftgrain, fvec_t * onset) {157 cvec_t * fftgrain, fvec_t * onset) {
158 uint_t i,j;158 uint_t i,j;
159 for (i=0;i<fftgrain->channels;i++) {159 for (i=0;i<fftgrain->channels;i++) {
@@ -165,7 +165,7 @@ void aubio_onsetdetection_energy (aubio_onsetdetection_t *o UNUSED, · 5 unmodified lines
165}165}
166 166
167/* High Frequency Content onset detection function */167/* High Frequency Content onset detection function */
168void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o UNUSED,168void aubio_specdesc_hfc(aubio_specdesc_t *o UNUSED,
169 cvec_t * fftgrain, fvec_t * onset){169 cvec_t * fftgrain, fvec_t * onset){
170 uint_t i,j;170 uint_t i,j;
171 for (i=0;i<fftgrain->channels;i++) {171 for (i=0;i<fftgrain->channels;i++) {
@@ -178,7 +178,7 @@ void aubio_onsetdetection_hfc(aubio_onsetdetection_t *o UNUSED, · 6 unmodified lines
178 178
179 179
180/* Complex Domain Method onset detection function */180/* Complex Domain Method onset detection function */
181void aubio_onsetdetection_complex (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset) {181void aubio_specdesc_complex (aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset) {
182 uint_t i, j;182 uint_t i, j;
183 uint_t nbins = fftgrain->length;183 uint_t nbins = fftgrain->length;
184 for (i=0;i<fftgrain->channels; i++) {184 for (i=0;i<fftgrain->channels; i++) {
@@ -203,7 +203,7 @@ void aubio_onsetdetection_complex (aubio_onsetdetection_t *o, cvec_t * fftgrain, · 18 unmodified lines
203 203
204 204
205/* Phase Based Method onset detection function */205/* Phase Based Method onset detection function */
206void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, 206void aubio_specdesc_phase(aubio_specdesc_t *o,
207 cvec_t * fftgrain, fvec_t * onset){207 cvec_t * fftgrain, fvec_t * onset){
208 uint_t i, j;208 uint_t i, j;
209 uint_t nbins = fftgrain->length;209 uint_t nbins = fftgrain->length;
@@ -235,7 +235,7 @@ void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, · 25 unmodified lines
235}235}
236 236
237/* Spectral difference method onset detection function */237/* Spectral difference method onset detection function */
238void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o,238void aubio_specdesc_specdiff(aubio_specdesc_t *o,
239 cvec_t * fftgrain, fvec_t * onset){239 cvec_t * fftgrain, fvec_t * onset){
240 uint_t i, j;240 uint_t i, j;
241 uint_t nbins = fftgrain->length;241 uint_t nbins = fftgrain->length;
@@ -266,7 +266,7 @@ void aubio_onsetdetection_specdiff(aubio_onsetdetection_t *o, · 24 unmodified lines
266/* Kullback Liebler onset detection function266/* Kullback Liebler onset detection function
267 * note we use ln(1+Xn/(Xn-1+0.0001)) to avoid 267 * note we use ln(1+Xn/(Xn-1+0.0001)) to avoid
268 * negative (1.+) and infinite values (+1.e-10) */268 * negative (1.+) and infinite values (+1.e-10) */
269void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){269void aubio_specdesc_kl(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset){
270 uint_t i,j;270 uint_t i,j;
271 for (i=0;i<fftgrain->channels;i++) {271 for (i=0;i<fftgrain->channels;i++) {
272 onset->data[i][0] = 0.;272 onset->data[i][0] = 0.;
@@ -282,7 +282,7 @@ void aubio_onsetdetection_kl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_ · 9 unmodified lines
282/* Modified Kullback Liebler onset detection function282/* Modified Kullback Liebler onset detection function
283 * note we use ln(1+Xn/(Xn-1+0.0001)) to avoid 283 * note we use ln(1+Xn/(Xn-1+0.0001)) to avoid
284 * negative (1.+) and infinite values (+1.e-10) */284 * negative (1.+) and infinite values (+1.e-10) */
285void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){285void aubio_specdesc_mkl(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset){
286 uint_t i,j;286 uint_t i,j;
287 for (i=0;i<fftgrain->channels;i++) {287 for (i=0;i<fftgrain->channels;i++) {
288 onset->data[i][0] = 0.;288 onset->data[i][0] = 0.;
@@ -295,7 +295,7 @@ void aubio_onsetdetection_mkl(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec · 6 unmodified lines
295}295}
296 296
297/* Spectral flux */297/* Spectral flux */
298void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset){ 298void aubio_specdesc_specflux(aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset){
299 uint_t i, j;299 uint_t i, j;
300 for (i=0;i<fftgrain->channels;i++) {300 for (i=0;i<fftgrain->channels;i++) {
301 onset->data[i][0] = 0.;301 onset->data[i][0] = 0.;
@@ -309,7 +309,7 @@ void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, · 7 unmodified lines
309 309
310/* Generic function pointing to the choosen one */310/* Generic function pointing to the choosen one */
311void 311void
312aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, 312aubio_specdesc_do (aubio_specdesc_t *o, cvec_t * fftgrain,
313 fvec_t * onset) {313 fvec_t * onset) {
314 o->funcpointer(o,fftgrain,onset);314 o->funcpointer(o,fftgrain,onset);
315}315}
@@ -317,12 +317,12 @@ aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, · 1 unmodified line
317/* Allocate memory for an onset detection 317/* Allocate memory for an onset detection
318 * depending on the choosen type, allocate memory as needed318 * depending on the choosen type, allocate memory as needed
319 */319 */
320aubio_onsetdetection_t * 320aubio_specdesc_t *
321new_aubio_onsetdetection (char_t * onset_mode, 321new_aubio_specdesc (char_t * onset_mode,
322 uint_t size, uint_t channels){322 uint_t size, uint_t channels){
323 aubio_onsetdetection_t * o = AUBIO_NEW(aubio_onsetdetection_t);323 aubio_specdesc_t * o = AUBIO_NEW(aubio_specdesc_t);
324 uint_t rsize = size/2+1;324 uint_t rsize = size/2+1;
325 aubio_onsetdetection_type onset_type;325 aubio_specdesc_type onset_type;
326 if (strcmp (onset_mode, "energy") == 0)326 if (strcmp (onset_mode, "energy") == 0)
327 onset_type = aubio_onset_energy;327 onset_type = aubio_onset_energy;
328 else if (strcmp (onset_mode, "specdiff") == 0)328 else if (strcmp (onset_mode, "specdiff") == 0)
@@ -388,28 +388,28 @@ new_aubio_onsetdetection (char_t * onset_mode, · 59 unmodified lines
388 388
389 switch(onset_type) {389 switch(onset_type) {
390 case aubio_onset_energy:390 case aubio_onset_energy:
391 o->funcpointer = aubio_onsetdetection_energy;391 o->funcpointer = aubio_specdesc_energy;
392 break;392 break;
393 case aubio_onset_hfc:393 case aubio_onset_hfc:
394 o->funcpointer = aubio_onsetdetection_hfc;394 o->funcpointer = aubio_specdesc_hfc;
395 break;395 break;
396 case aubio_onset_complex:396 case aubio_onset_complex:
397 o->funcpointer = aubio_onsetdetection_complex;397 o->funcpointer = aubio_specdesc_complex;
398 break;398 break;
399 case aubio_onset_phase:399 case aubio_onset_phase:
400 o->funcpointer = aubio_onsetdetection_phase;400 o->funcpointer = aubio_specdesc_phase;
401 break;401 break;
402 case aubio_onset_specdiff:402 case aubio_onset_specdiff:
403 o->funcpointer = aubio_onsetdetection_specdiff;403 o->funcpointer = aubio_specdesc_specdiff;
404 break;404 break;
405 case aubio_onset_kl:405 case aubio_onset_kl:
406 o->funcpointer = aubio_onsetdetection_kl;406 o->funcpointer = aubio_specdesc_kl;
407 break;407 break;
408 case aubio_onset_mkl:408 case aubio_onset_mkl:
409 o->funcpointer = aubio_onsetdetection_mkl;409 o->funcpointer = aubio_specdesc_mkl;
410 break;410 break;
411 case aubio_onset_specflux:411 case aubio_onset_specflux:
412 o->funcpointer = aubio_onsetdetection_specflux;412 o->funcpointer = aubio_specdesc_specflux;
413 break;413 break;
414 default:414 default:
415 break;415 break;
@@ -418,7 +418,7 @@ new_aubio_onsetdetection (char_t * onset_mode, · 2 unmodified lines
418 return o;418 return o;
419}419}
420 420
421void del_aubio_onsetdetection (aubio_onsetdetection_t *o){421void del_aubio_specdesc (aubio_specdesc_t *o){
422 switch(o->onset_type) {422 switch(o->onset_type) {
423 /* for both energy and hfc, only fftgrain->norm is required */423 /* for both energy and hfc, only fftgrain->norm is required */
424 case aubio_onset_energy: 424 case aubio_onset_energy:
src/spectral/specdesc.hrenamed from src/onset/onsetdetection.h+6−6
@@ -40,17 +40,17 @@ extern "C" { · 39 unmodified lines
40#endif40#endif
41 41
42/** onsetdetection structure */42/** onsetdetection structure */
43typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t;43typedef struct _aubio_specdesc_t aubio_specdesc_t;
44/** execute onset detection function on a spectral frame 44/** execute onset detection function on a spectral frame
45 45
46 Generic function to compute onset detection.46 Generic function to compute onset detection.
47 47
48 \param o onset detection object as returned by new_aubio_onsetdetection()48 \param o onset detection object as returned by new_aubio_specdesc()
49 \param fftgrain input signal spectrum as computed by aubio_pvoc_do49 \param fftgrain input signal spectrum as computed by aubio_pvoc_do
50 \param onset output vector (one sample long, to send to the peak picking)50 \param onset output vector (one sample long, to send to the peak picking)
51 51
52*/52*/
53void aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);53void aubio_specdesc_do (aubio_specdesc_t *o, cvec_t * fftgrain, fvec_t * onset);
54/** creation of an onset detection object 54/** creation of an onset detection object
55 55
56 \param type onset detection mode56 \param type onset detection mode
@@ -58,13 +58,13 @@ void aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec · 1 unmodified line
58 \param channels number of input channels58 \param channels number of input channels
59 59
60*/60*/
61aubio_onsetdetection_t * new_aubio_onsetdetection(char_t * onset_mode, uint_t buf_size, uint_t channels);61aubio_specdesc_t * new_aubio_specdesc(char_t * onset_mode, uint_t buf_size, uint_t channels);
62/** deletion of an onset detection object62/** deletion of an onset detection object
63 63
64 \param o onset detection object as returned by new_aubio_onsetdetection()64 \param o onset detection object as returned by new_aubio_specdesc()
65 65
66*/66*/
67void del_aubio_onsetdetection(aubio_onsetdetection_t *o);67void del_aubio_specdesc(aubio_specdesc_t *o);
68 68
69#ifdef __cplusplus69#ifdef __cplusplus
70}70}
src/tempo/tempo.c+7−7
@@ -21,7 +21,7 @@ · 20 unmodified lines
21#include "aubio_priv.h"21#include "aubio_priv.h"
22#include "fvec.h"22#include "fvec.h"
23#include "cvec.h"23#include "cvec.h"
24#include "onset/onsetdetection.h"24#include "spectral/specdesc.h"
25#include "tempo/beattracking.h"25#include "tempo/beattracking.h"
26#include "spectral/phasevoc.h"26#include "spectral/phasevoc.h"
27#include "onset/peakpick.h"27#include "onset/peakpick.h"
@@ -30,7 +30,7 @@ · 2 unmodified lines
30 30
31/* structure to store object state */31/* structure to store object state */
32struct _aubio_tempo_t {32struct _aubio_tempo_t {
33 aubio_onsetdetection_t * od; /** onset detection */33 aubio_specdesc_t * od; /** onset detection */
34 aubio_pvoc_t * pv; /** phase vocoder */34 aubio_pvoc_t * pv; /** phase vocoder */
35 aubio_peakpicker_t * pp; /** peak picker */35 aubio_peakpicker_t * pp; /** peak picker */
36 aubio_beattracking_t * bt; /** beat tracking */36 aubio_beattracking_t * bt; /** beat tracking */
@@ -55,9 +55,9 @@ void aubio_tempo_do(aubio_tempo_t *o, fvec_t * input, fvec_t * tempo) · 18 unmodified lines
55 uint_t winlen = o->winlen;55 uint_t winlen = o->winlen;
56 uint_t step = o->step;56 uint_t step = o->step;
57 aubio_pvoc_do (o->pv, input, o->fftgrain);57 aubio_pvoc_do (o->pv, input, o->fftgrain);
58 aubio_onsetdetection_do (o->od, o->fftgrain, o->of);58 aubio_specdesc_do (o->od, o->fftgrain, o->of);
59 /*if (usedoubled) {59 /*if (usedoubled) {
60 aubio_onsetdetection_do(o2,fftgrain, onset2);60 aubio_specdesc_do(o2,fftgrain, onset2);
61 onset->data[0][0] *= onset2->data[0][0];61 onset->data[0][0] *= onset2->data[0][0];
62 }*/62 }*/
63 /* execute every overlap_size*step */63 /* execute every overlap_size*step */
@@ -120,13 +120,13 @@ aubio_tempo_t * new_aubio_tempo (char_t * onset_mode, · 56 unmodified lines
120 o->pv = new_aubio_pvoc(buf_size, hop_size, channels);120 o->pv = new_aubio_pvoc(buf_size, hop_size, channels);
121 o->pp = new_aubio_peakpicker(channels);121 o->pp = new_aubio_peakpicker(channels);
122 aubio_peakpicker_set_threshold (o->pp, o->threshold);122 aubio_peakpicker_set_threshold (o->pp, o->threshold);
123 o->od = new_aubio_onsetdetection(onset_mode,buf_size,channels);123 o->od = new_aubio_specdesc(onset_mode,buf_size,channels);
124 o->of = new_fvec(1, channels);124 o->of = new_fvec(1, channels);
125 o->bt = new_aubio_beattracking(o->winlen,channels);125 o->bt = new_aubio_beattracking(o->winlen,channels);
126 o->onset = new_fvec(1, channels);126 o->onset = new_fvec(1, channels);
127 o->peek = new_fvec(3, channels);127 o->peek = new_fvec(3, channels);
128 /*if (usedoubled) {128 /*if (usedoubled) {
129 o2 = new_aubio_onsetdetection(type_onset2,buffer_size,channels);129 o2 = new_aubio_specdesc(type_onset2,buffer_size,channels);
130 onset2 = new_fvec(1 , channels);130 onset2 = new_fvec(1 , channels);
131 }*/131 }*/
132 return o;132 return o;
@@ -142,7 +142,7 @@ smpl_t aubio_tempo_get_confidence(aubio_tempo_t *o) { · 9 unmodified lines
142 142
143void del_aubio_tempo (aubio_tempo_t *o)143void del_aubio_tempo (aubio_tempo_t *o)
144{144{
145 del_aubio_onsetdetection(o->od);145 del_aubio_specdesc(o->od);
146 del_aubio_beattracking(o->bt);146 del_aubio_beattracking(o->bt);
147 del_aubio_peakpicker(o->pp);147 del_aubio_peakpicker(o->pp);
148 del_aubio_pvoc(o->pv);148 del_aubio_pvoc(o->pv);
tests/src/test-onsetdetection.c+22−22
@@ -11,35 +11,35 @@ main () · 10 unmodified lines
11 cvec_t *in = new_cvec (win_s, channels); /* input buffer */11 cvec_t *in = new_cvec (win_s, channels); /* input buffer */
12 fvec_t *out = new_fvec (1, channels); /* input buffer */12 fvec_t *out = new_fvec (1, channels); /* input buffer */
13 13
14 aubio_onsetdetection_t *o;14 aubio_specdesc_t *o;
15 15
16 o = new_aubio_onsetdetection ("energy", win_s, channels);16 o = new_aubio_specdesc ("energy", win_s, channels);
17 aubio_onsetdetection_do (o, in, out);17 aubio_specdesc_do (o, in, out);
18 del_aubio_onsetdetection (o);18 del_aubio_specdesc (o);
19 19
20 o = new_aubio_onsetdetection ("energy", win_s, channels);20 o = new_aubio_specdesc ("energy", win_s, channels);
21 aubio_onsetdetection_do (o, in, out);21 aubio_specdesc_do (o, in, out);
22 del_aubio_onsetdetection (o);22 del_aubio_specdesc (o);
23 23
24 o = new_aubio_onsetdetection ("hfc", win_s, channels);24 o = new_aubio_specdesc ("hfc", win_s, channels);
25 aubio_onsetdetection_do (o, in, out);25 aubio_specdesc_do (o, in, out);
26 del_aubio_onsetdetection (o);26 del_aubio_specdesc (o);
27 27
28 o = new_aubio_onsetdetection ("complex", win_s, channels);28 o = new_aubio_specdesc ("complex", win_s, channels);
29 aubio_onsetdetection_do (o, in, out);29 aubio_specdesc_do (o, in, out);
30 del_aubio_onsetdetection (o);30 del_aubio_specdesc (o);
31 31
32 o = new_aubio_onsetdetection ("phase", win_s, channels);32 o = new_aubio_specdesc ("phase", win_s, channels);
33 aubio_onsetdetection_do (o, in, out);33 aubio_specdesc_do (o, in, out);
34 del_aubio_onsetdetection (o);34 del_aubio_specdesc (o);
35 35
36 o = new_aubio_onsetdetection ("kl", win_s, channels);36 o = new_aubio_specdesc ("kl", win_s, channels);
37 aubio_onsetdetection_do (o, in, out);37 aubio_specdesc_do (o, in, out);
38 del_aubio_onsetdetection (o);38 del_aubio_specdesc (o);
39 39
40 o = new_aubio_onsetdetection ("mkl", win_s, channels);40 o = new_aubio_specdesc ("mkl", win_s, channels);
41 aubio_onsetdetection_do (o, in, out);41 aubio_specdesc_do (o, in, out);
42 del_aubio_onsetdetection (o);42 del_aubio_specdesc (o);
43 43
44 del_cvec (in);44 del_cvec (in);
45 del_fvec (out);45 del_fvec (out);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t