Changeset aea235c for tests/src/test-phasevoc-jack.c
- Timestamp:
- Dec 4, 2009, 1:47:17 AM (14 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- f7b05d4
- Parents:
- 4621cd6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/test-phasevoc-jack.c
r4621cd6 raea235c 22 22 uint_t pos = 0; /* frames%dspblocksize for jack loop */ 23 23 24 fvec_t * in ;25 cvec_t * fftgrain ;26 fvec_t * out ;24 fvec_t * in[2]; 25 cvec_t * fftgrain[2]; 26 fvec_t * out[2]; 27 27 28 aubio_pvoc_t * pv ;28 aubio_pvoc_t * pv[2]; 29 29 30 30 int aubio_process(float **input, float **output, int nframes); … … 32 32 int main(){ 33 33 /* allocate some memory */ 34 in = new_fvec (hop_s, channels); /* input buffer */ 35 fftgrain = new_cvec (win_s, channels); /* fft norm and phase */ 36 out = new_fvec (hop_s, channels); /* output buffer */ 34 uint_t i; 35 for (i=0;i<channels;i++) { 36 in[i] = new_fvec (hop_s); /* input buffer */ 37 fftgrain[i] = new_cvec (win_s); /* fft norm and phase */ 38 out[i] = new_fvec (hop_s); /* output buffer */ 37 39 /* allocate fft and other memory space */ 38 pv = new_aubio_pvoc(win_s,hop_s,channels); 40 pv[i] = new_aubio_pvoc(win_s,hop_s); 41 } 39 42 40 43 #ifdef HAVE_JACK … … 53 56 #endif 54 57 55 del_aubio_pvoc(pv); 56 del_cvec(fftgrain); 57 del_fvec(in); 58 del_fvec(out); 58 for (i=0;i<channels;i++) { 59 del_aubio_pvoc(pv[i]); 60 del_cvec(fftgrain[i]); 61 del_fvec(in[i]); 62 del_fvec(out[i]); 63 } 59 64 aubio_cleanup(); 60 65 return 0; … … 67 72 for (i=0;i<channels;i++) { 68 73 /* write input to datanew */ 69 fvec_write_sample(in , input[i][j], i, pos);74 fvec_write_sample(in[i], input[i][j], pos); 70 75 /* put synthnew in output */ 71 output[i][j] = fvec_read_sample(out , i, pos);76 output[i][j] = fvec_read_sample(out[i], pos); 72 77 } 73 78 /*time for fft*/ 74 79 if (pos == hop_s-1) { 75 80 /* block loop */ 76 aubio_pvoc_do (pv,in, fftgrain); 81 for (i=0;i<channels;i++) { 82 aubio_pvoc_do (pv[i], in[i], fftgrain[i]); 77 83 // zero phases of first channel 78 for (i=0;i<fftgrain ->length;i++) fftgrain->phas[0][i] = 0.;84 for (i=0;i<fftgrain[i]->length;i++) fftgrain[0]->phas[i] = 0.; 79 85 // double phases of second channel 80 for (i=0;i<fftgrain ->length;i++) {81 fftgrain ->phas[1][i] =82 aubio_unwrap2pi (fftgrain ->phas[1][i] * 2.);86 for (i=0;i<fftgrain[i]->length;i++) { 87 fftgrain[1]->phas[i] = 88 aubio_unwrap2pi (fftgrain[1]->phas[i] * 2.); 83 89 } 84 90 // copy second channel to third one 85 aubio_pvoc_rdo(pv ,fftgrain,out);91 aubio_pvoc_rdo(pv[i], fftgrain[i], out[i]); 86 92 pos = -1; 93 } 87 94 } 88 95 pos++;
Note: See TracChangeset
for help on using the changeset viewer.