From 8b2dc90d23eeba02fc8730a77c22138ed1905f0a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 7 Nov 2007 16:32:03 +0100 Subject: [PATCH] phasevoc.c,pitch{fcomb,yinfft}.c: update to new aubio_fft --- src/phasevoc.c | 23 ++++++++++++----------- src/pitchfcomb.c | 8 ++++---- src/pitchyinfft.c | 10 +++++----- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/phasevoc.c b/src/phasevoc.c index 6fdf6cf0..b04b106f 100644 --- a/src/phasevoc.c +++ b/src/phasevoc.c @@ -18,7 +18,8 @@ */ #include "aubio_priv.h" -#include "sample.h" +#include "fvec.h" +#include "cvec.h" #include "fft.h" #include "mathutils.h" #include "phasevoc.h" @@ -28,12 +29,12 @@ struct _aubio_pvoc_t { uint_t win_s; /** grain length */ uint_t hop_s; /** overlap step */ uint_t channels; /** number of channels */ - aubio_mfft_t * fft; /** spectral data */ - fvec_t * synth; /**cur output grain [win_s] */ - fvec_t * synthold; /**last input frame [win_s-hop_s] */ - fvec_t * data; /**current input grain [win_s] */ - fvec_t * dataold; /**last input frame [win_s-hop_s] */ - smpl_t * w; /** grain window [win_s] */ + aubio_fft_t * fft; /** fft object */ + fvec_t * synth; /** cur output grain [win_s] */ + fvec_t * synthold; /** last input frame [win_s-hop_s] */ + fvec_t * data; /** current input grain [win_s] */ + fvec_t * dataold; /** last input frame [win_s-hop_s] */ + smpl_t * w; /** grain window [win_s] */ }; @@ -57,13 +58,13 @@ void aubio_pvoc_do(aubio_pvoc_t *pv, fvec_t * datanew, cvec_t *fftgrain) { /* shift */ vec_shift(pv->data); /* calculate fft */ - aubio_mfft_do (pv->fft,pv->data,fftgrain); + aubio_fft_do (pv->fft,pv->data,fftgrain); } void aubio_pvoc_rdo(aubio_pvoc_t *pv,cvec_t * fftgrain, fvec_t * synthnew) { uint_t i; /* calculate rfft */ - aubio_mfft_rdo(pv->fft,fftgrain,pv->synth); + aubio_fft_rdo(pv->fft,fftgrain,pv->synth); /* unshift */ vec_shift(pv->synth); for (i=0; ichannels; i++) { @@ -87,7 +88,7 @@ aubio_pvoc_t * new_aubio_pvoc (uint_t win_s, uint_t hop_s, uint_t channels) { hop_s = win_s / 2; } - pv->fft = new_aubio_mfft(win_s,channels); + pv->fft = new_aubio_fft(win_s,channels); /* remember old */ pv->data = new_fvec (win_s, channels); @@ -111,7 +112,7 @@ void del_aubio_pvoc(aubio_pvoc_t *pv) { del_fvec(pv->synth); del_fvec(pv->dataold); del_fvec(pv->synthold); - del_aubio_mfft(pv->fft); + del_aubio_fft(pv->fft); AUBIO_FREE(pv->w); AUBIO_FREE(pv); } diff --git a/src/pitchfcomb.c b/src/pitchfcomb.c index 9321b35d..96e47d0b 100644 --- a/src/pitchfcomb.c +++ b/src/pitchfcomb.c @@ -38,7 +38,7 @@ struct _aubio_pitchfcomb_t { fvec_t * win; cvec_t * fftOut; fvec_t * fftLastPhase; - aubio_mfft_t * fft; + aubio_fft_t * fft; //aubio_pvoc_t * pvoc; }; @@ -51,7 +51,7 @@ aubio_pitchfcomb_t * new_aubio_pitchfcomb (uint_t bufsize, uint_t hopsize, uint_ p->winput = new_fvec(bufsize,1); p->fftOut = new_cvec(bufsize,1); p->fftLastPhase = new_fvec(bufsize,1); - p->fft = new_aubio_mfft(bufsize, 1); + p->fft = new_aubio_fft(bufsize, 1); p->win = new_fvec(bufsize,1); aubio_window(p->win->data[0], bufsize, aubio_win_hanning); return p; @@ -73,7 +73,7 @@ smpl_t aubio_pitchfcomb_detect (aubio_pitchfcomb_t * p, fvec_t * input) for (k=0; k < input->length; k++){ p->winput->data[0][k] = p->win->data[0][k] * input->data[0][k]; } - aubio_mfft_do(p->fft,p->winput,p->fftOut); + aubio_fft_do(p->fft,p->winput,p->fftOut); for (k=0; k<=p->fftSize/2; k++) { smpl_t @@ -129,7 +129,7 @@ void del_aubio_pitchfcomb (aubio_pitchfcomb_t * p) del_fvec(p->fftLastPhase); del_fvec(p->win); del_fvec(p->winput); - del_aubio_mfft(p->fft); + del_aubio_fft(p->fft); AUBIO_FREE(p); } diff --git a/src/pitchyinfft.c b/src/pitchyinfft.c index a5c26ff5..5018a28a 100644 --- a/src/pitchyinfft.c +++ b/src/pitchyinfft.c @@ -30,7 +30,7 @@ struct _aubio_pitchyinfft_t { fvec_t * sqrmag; /**< square difference function */ fvec_t * weight; /**< spectral weighting window (psychoacoustic model) */ cvec_t * fftout; /**< Fourier transform output */ - aubio_mfft_t * fft; /**< fft object to compute square difference function */ + aubio_fft_t * fft; /**< fft object to compute square difference function */ fvec_t * yinfft; /**< Yin function */ }; @@ -48,7 +48,7 @@ aubio_pitchyinfft_t * new_aubio_pitchyinfft (uint_t bufsize) { aubio_pitchyinfft_t * p = AUBIO_NEW(aubio_pitchyinfft_t); p->winput = new_fvec(bufsize,1); - p->fft = new_aubio_mfft(bufsize, 1); + p->fft = new_aubio_fft(bufsize, 1); p->fftout = new_cvec(bufsize,1); p->sqrmag = new_fvec(bufsize,1); p->res = new_cvec(bufsize,1); @@ -96,7 +96,7 @@ smpl_t aubio_pitchyinfft_detect(aubio_pitchyinfft_t * p, fvec_t * input, smpl_t for (l=0; l < input->length; l++){ p->winput->data[0][l] = p->win->data[0][l] * input->data[0][l]; } - aubio_mfft_do(p->fft,p->winput,p->fftout); + aubio_fft_do(p->fft,p->winput,p->fftout); for (l=0; l < p->fftout->length; l++){ p->sqrmag->data[0][l] = SQR(p->fftout->norm[0][l]); p->sqrmag->data[0][l] *= p->weight->data[0][l]; @@ -111,7 +111,7 @@ smpl_t aubio_pitchyinfft_detect(aubio_pitchyinfft_t * p, fvec_t * input, smpl_t sum += p->sqrmag->data[0][l]; } sum *= 2.; - aubio_mfft_do(p->fft,p->sqrmag,res); + aubio_fft_do(p->fft,p->sqrmag,res); yin->data[0][0] = 1.; for (tau=1; tau < yin->length; tau++) { yin->data[0][tau] = sum - @@ -142,7 +142,7 @@ smpl_t aubio_pitchyinfft_detect(aubio_pitchyinfft_t * p, fvec_t * input, smpl_t void del_aubio_pitchyinfft(aubio_pitchyinfft_t *p){ del_fvec(p->win); - del_aubio_mfft(p->fft); + del_aubio_fft(p->fft); del_fvec(p->yinfft); del_fvec(p->sqrmag); del_cvec(p->res); -- 2.26.2