#include "mathutils.h"
#include "config.h"
-void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype) {
+fvec_t * new_aubio_window(uint_t size, aubio_window_type wintype) {
+ // create fvec of size x 1 channel
+ fvec_t * win = new_fvec( size, 1);
+ smpl_t * w = win->data[0];
uint_t i;
switch(wintype) {
case aubio_win_rectangle:
default:
break;
}
+ return win;
}
smpl_t aubio_unwrap2pi(smpl_t phase) {
} aubio_window_type;
/** create window */
-void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype);
+fvec_t * new_aubio_window(uint_t size, aubio_window_type wintype);
/** principal argument
*
p->fftOut = new_cvec(bufsize,1);
p->fftLastPhase = new_fvec(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);
+ p->win = new_aubio_window(bufsize, aubio_win_hanning);
return p;
}
p->sqrmag = new_fvec(bufsize,1);
p->res = new_cvec(bufsize,1);
p->yinfft = new_fvec(bufsize/2+1,1);
- p->win = new_fvec(bufsize,1);
- aubio_window(p->win->data[0], bufsize, aubio_win_hanningz);
+ p->win = new_aubio_window(bufsize, aubio_win_hanningz);
p->weight = new_fvec(bufsize/2+1,1);
{
uint_t i = 0, j = 1;
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] */
+ fvec_t * w; /** grain window [win_s] */
};
aubio_pvoc_swapbuffers(pv->data->data[i],pv->dataold->data[i],
datanew->data[i],pv->win_s,pv->hop_s);
/* windowing */
- for (j=0; j<pv->win_s; j++) pv->data->data[i][j] *= pv->w[j];
+ fvec_weight(pv->data, pv->w);
}
/* shift */
vec_shift(pv->data);
/* new input output */
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);
- aubio_window(pv->w,win_s,aubio_win_hanningz);
+ pv->w = new_aubio_window (win_s, aubio_win_hanningz);
pv->channels = channels;
pv->hop_s = hop_s;
del_fvec(pv->synth);
del_fvec(pv->dataold);
del_fvec(pv->synthold);
+ del_fvec(pv->w);
del_aubio_fft(pv->fft);
- AUBIO_FREE(pv->w);
AUBIO_FREE(pv);
}
aubio_win_parzen
} aubio_window_type;
-void aubio_window(smpl_t *w, uint_t size, aubio_window_type wintype);
+fvec_t * new_aubio_window(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);