From 28d8c4aa38dfbbb65fcc01c83037c0fb223e791a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 9 Aug 2005 10:09:36 +0000 Subject: [PATCH] prefix mathutils function with aubio_ --- examples/tests/test-fft.c | 4 ++-- examples/utils.c | 2 +- src/fft.c | 2 +- src/mathutils.c | 18 +++++++++--------- src/mathutils.h | 14 +++++++------- src/onsetdetection.c | 4 ++-- src/phasevoc.c | 2 +- src/pitchdetection.c | 4 ++-- src/pitchfcomb.c | 2 +- src/tss.c | 2 +- swig/aubio.i | 14 +++++++------- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/examples/tests/test-fft.c b/examples/tests/test-fft.c index c61e1b5a..e89babef 100644 --- a/examples/tests/test-fft.c +++ b/examples/tests/test-fft.c @@ -19,7 +19,7 @@ int main(){ for (i=0; i < channels; i++) spec[i] = AUBIO_ARRAY(fft_data_t,win_s); /* initialize the window (see mathutils.c) */ - window(w,win_s,aubio_win_hanningz); + aubio_window(w,win_s,aubio_win_hanningz); /* fill input with some data */ @@ -34,7 +34,7 @@ int main(){ /* execute inverse fourier transform */ for (i=0; i < channels; i++) { for (j=0; jphas[i][j])); + spec[i][j] = CEXPC(I*aubio_unwrap2pi(fftgrain->phas[i][j])); spec[i][j] *= fftgrain->norm[i][j]; } aubio_fft_rdo(fft,spec[i],out->data[i],win_s); diff --git a/examples/utils.c b/examples/utils.c index e76af4a4..1d1b99e3 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -329,7 +329,7 @@ void examples_common_process(aubio_process_func_t process_func, aubio_print_func void send_noteon(int pitch, int velo) { - smpl_t mpitch = (FLOOR)(freqtomidi(pitch)+.5); + smpl_t mpitch = (FLOOR)(aubio_freqtomidi(pitch)+.5); /* we should check if we use midi here, not jack */ #if ALSA_SUPPORT if (usejack) { diff --git a/src/fft.c b/src/fft.c index 2e6bf580..d10cb835 100644 --- a/src/fft.c +++ b/src/fft.c @@ -149,7 +149,7 @@ void aubio_mfft_rdo(aubio_mfft_t * fft,cvec_t * fftgrain, fvec_t * out){ uint_t i=0,j; for (i=0; i < fft->channels; i++) { for (j=0; jwinsize/2+1; j++) { - fft->spec[i][j] = CEXPC(I*unwrap2pi(fftgrain->phas[i][j])); + fft->spec[i][j] = CEXPC(I*aubio_unwrap2pi(fftgrain->phas[i][j])); fft->spec[i][j] *= fftgrain->norm[i][j]; } aubio_fft_rdo(fft->fft,fft->spec[i],out->data[i],fft->winsize); diff --git a/src/mathutils.c b/src/mathutils.c index 88dce048..b523d0ec 100644 --- a/src/mathutils.c +++ b/src/mathutils.c @@ -23,7 +23,7 @@ #include "sample.h" #include "mathutils.h" -void window(smpl_t *w, uint_t size, aubio_window_type_t wintype) { +void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype) { uint_t i; switch(wintype) { case aubio_win_rectangle: @@ -73,7 +73,7 @@ void window(smpl_t *w, uint_t size, aubio_window_type_t wintype) { } -smpl_t unwrap2pi(smpl_t phase) { +smpl_t aubio_unwrap2pi(smpl_t phase) { /* mod(phase+pi,-2pi)+pi */ return phase + TWO_PI * (1. + floorf(-(phase+PI)/TWO_PI)); } @@ -318,7 +318,7 @@ smpl_t vec_quadint(fvec_t * x,uint_t pos) { s2 = x->data[0][pos+span]; /* increase frac */ for (frac = 0.; frac < 2.; frac = frac + step) { - res = quadfrac(s0, s1, s2, frac); + res = aubio_quadfrac(s0, s1, s2, frac); if (res > resold) resold = res; else { @@ -330,7 +330,7 @@ smpl_t vec_quadint(fvec_t * x,uint_t pos) { return exactpos; } -smpl_t quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf) { +smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf) { smpl_t tmp = s0 + (pf/2.) * (pf * ( s0 - 2.*s1 + s2 ) - 3.*s0 + 4.*s1 - s2); return tmp; } @@ -344,7 +344,7 @@ uint_t vec_peakpick(fvec_t * onset, uint_t pos) { return tmp; } -smpl_t freqtomidi(smpl_t freq) { +smpl_t aubio_freqtomidi(smpl_t freq) { smpl_t midi = freq/6.875; /* log(freq/A-2)/log(2) */ midi = LOG(midi)/0.69314718055995; @@ -353,15 +353,15 @@ smpl_t freqtomidi(smpl_t freq) { return midi; } -smpl_t bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize) { +smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize) { smpl_t freq = samplerate/fftsize; return freq*bin; } -smpl_t bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize) { - smpl_t midi = bintofreq(bin,samplerate,fftsize); - return freqtomidi(midi); +smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize) { + smpl_t midi = aubio_bintofreq(bin,samplerate,fftsize); + return aubio_freqtomidi(midi); } diff --git a/src/mathutils.h b/src/mathutils.h index 8925bdc3..e61855a7 100644 --- a/src/mathutils.h +++ b/src/mathutils.h @@ -103,16 +103,16 @@ typedef enum { aubio_win_gaussian, aubio_win_welch, aubio_win_parzen -} aubio_window_type_t; +} aubio_window_type; /** create window */ -void window(smpl_t *w, uint_t size, aubio_window_type_t wintype); +void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype); /** principal argument * * mod(phase+PI,-TWO_PI)+PI */ -smpl_t unwrap2pi (smpl_t phase); +smpl_t aubio_unwrap2pi (smpl_t phase); /** calculates the mean of a vector * @@ -224,14 +224,14 @@ smpl_t vec_quadint(fvec_t * x,uint_t pos); * \param s0,s1,s2 are 3 known points on the curve, * \param pf is the floating point index [0;2] */ -smpl_t quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf); +smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf); /** returns 1 if X1 is a peak and positive */ uint_t vec_peakpick(fvec_t * input, uint_t pos); -smpl_t bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize); -smpl_t bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize); -smpl_t freqtomidi(smpl_t freq); +smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize); +smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize); +smpl_t aubio_freqtomidi(smpl_t freq); uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold); smpl_t aubio_level_detection(fvec_t * ibuf, smpl_t threshold); diff --git a/src/onsetdetection.c b/src/onsetdetection.c index 8810e8b3..6111e8e7 100644 --- a/src/onsetdetection.c +++ b/src/onsetdetection.c @@ -73,7 +73,7 @@ void aubio_onsetdetection_complex (aubio_onsetdetection_t *o, cvec_t * fftgrain, for (i=0;ichannels; i++) { onset->data[i][0] = 0.; for (j=0;jdev1->data[i][j] = unwrap2pi( + o->dev1->data[i][j] = aubio_unwrap2pi( fftgrain->phas[i][j] -2.0*o->theta1->data[i][j]+ o->theta2->data[i][j]); @@ -103,7 +103,7 @@ void aubio_onsetdetection_phase(aubio_onsetdetection_t *o, o->dev1->data[i][0]=0.; for ( j=0;jdev1->data[i][j] = - unwrap2pi( + aubio_unwrap2pi( fftgrain->phas[i][j] -2.0*o->theta1->data[i][j] +o->theta2->data[i][j]); diff --git a/src/phasevoc.c b/src/phasevoc.c index d25dbaa8..aae7ea59 100644 --- a/src/phasevoc.c +++ b/src/phasevoc.c @@ -113,7 +113,7 @@ aubio_pvoc_t * new_aubio_pvoc (uint_t win_s, uint_t hop_s, uint_t channels) { pv->dataold = new_fvec (win_s-hop_s, channels); pv->synthold = new_fvec (win_s-hop_s, channels); pv->w = AUBIO_ARRAY(smpl_t,win_s); - window(pv->w,win_s,aubio_win_hanningz); + aubio_window(pv->w,win_s,aubio_win_hanningz); pv->channels = channels; pv->hop_s = hop_s; diff --git a/src/pitchdetection.c b/src/pitchdetection.c index fec2c242..1093b478 100644 --- a/src/pitchdetection.c +++ b/src/pitchdetection.c @@ -138,9 +138,9 @@ smpl_t aubio_pitchdetection_mcomb(aubio_pitchdetection_t *p, fvec_t *ibuf) { smpl_t pitch = 0.; aubio_pvoc_do(p->pv,ibuf,p->fftgrain); pitch = aubio_pitchmcomb_detect(p->mcomb,p->fftgrain); - /** \bug should move the >0 check within bintofreq */ + /** \bug should move the >0 check within aubio_bintofreq */ if (pitch>0.) { - pitch = bintofreq(pitch,p->srate,p->bufsize); + pitch = aubio_bintofreq(pitch,p->srate,p->bufsize); } else { pitch = 0.; } diff --git a/src/pitchfcomb.c b/src/pitchfcomb.c index fccf9557..db00febb 100644 --- a/src/pitchfcomb.c +++ b/src/pitchfcomb.c @@ -90,7 +90,7 @@ smpl_t aubio_pitchfcomb_detect (aubio_pitchfcomb_t * p, fvec_t * input) tmp -= (smpl_t)k*phaseDifference; /* map delta phase into +/- Pi interval */ - tmp = unwrap2pi(tmp); + tmp = aubio_unwrap2pi(tmp); /* get deviation from bin frequency from the +/- Pi interval */ tmp = p->fftSize/input->length*tmp/(TWO_PI); diff --git a/src/tss.c b/src/tss.c index dcbe2365..768a433f 100644 --- a/src/tss.c +++ b/src/tss.c @@ -55,7 +55,7 @@ void aubio_tss_do(aubio_tss_t *o, cvec_t * input, /* second phase derivative */ for (i=0;iphas[i][j] + dev[i][j] = aubio_unwrap2pi(input->phas[i][j] -2.0*theta1[i][j]+theta2[i][j]); theta2[i][j] = theta1[i][j]; theta1[i][j] = input->phas[i][j]; diff --git a/swig/aubio.i b/swig/aubio.i index bc654c2c..22236916 100644 --- a/swig/aubio.i +++ b/swig/aubio.i @@ -97,10 +97,10 @@ typedef enum { aubio_win_gaussian, aubio_win_welch, aubio_win_parzen -} aubio_window_type_t; +} aubio_window_type; -void window(smpl_t *w, uint_t size, aubio_window_type_t wintype); -smpl_t unwrap2pi (smpl_t phase); +void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype); +smpl_t aubio_unwrap2pi (smpl_t phase); smpl_t vec_mean(fvec_t *s); smpl_t vec_max(fvec_t *s); smpl_t vec_min(fvec_t *s); @@ -118,11 +118,11 @@ void vec_adapt_thres(fvec_t * vec, fvec_t * tmp, uint_t post, uint_t pre); smpl_t vec_moving_thres(fvec_t * vec, fvec_t * tmp, uint_t post, uint_t pre, uint_t pos); smpl_t vec_median(fvec_t * input); smpl_t vec_quadint(fvec_t * x,uint_t pos); -smpl_t quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf); +smpl_t aubio_quadfrac(smpl_t s0, smpl_t s1, smpl_t s2, smpl_t pf); uint_t vec_peakpick(fvec_t * input, uint_t pos); -smpl_t bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize); -smpl_t bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize); -smpl_t freqtomidi(smpl_t freq); +smpl_t aubio_bintomidi(smpl_t bin, smpl_t samplerate, smpl_t fftsize); +smpl_t aubio_bintofreq(smpl_t bin, smpl_t samplerate, smpl_t fftsize); +smpl_t aubio_freqtomidi(smpl_t freq); uint_t aubio_silence_detection(fvec_t * ibuf, smpl_t threshold); smpl_t aubio_level_detection(fvec_t * ibuf, smpl_t threshold); -- 2.26.2