- Timestamp:
- Sep 25, 2009, 6:58:40 AM (15 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:
- 50bc5f2
- Parents:
- bccac6b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/test-phasevoc-jack.c
rbccac6b rc3f4173 1 /* test sample for phase vocoder1 /** Test for phase vocoder in jack 2 2 * 3 * this program should start correctly using JACK_START_SERVER=true and 4 * reconstruct each audio input frame perfectly on the corresponding input with 5 * a delay equal to the window size, hop_s. 3 * This program should start correctly, when jackd is started or when 4 * using JACK_START_SERVER=true and reconstruct each audio input channel 5 * on the corresponding output channel with some strange effects and a 6 * delay equal to the hop size (hop_s). 7 * 6 8 */ 7 9 8 #include <unistd.h> /* pause() orsleep() */10 #include <unistd.h> /* sleep() */ 9 11 #include <aubio.h> 10 12 #include <aubioext.h> 11 13 12 uint_t win_s = 32; /* window size */ 13 uint_t hop_s = 8; /* hop size */ 14 uint_t channels = 4; /* number of channels */ 14 uint_t testing = 1; /* change this to 1 to listen */ 15 16 uint_t win_s = 512;/* window size */ 17 uint_t hop_s = 128;/* hop size */ 18 uint_t channels = 2; /* number of audio channels */ 19 uint_t midiin = 4; /* number of midi input channels */ 20 uint_t midiout = 2; /* number of midi output channels */ 15 21 uint_t pos = 0; /* frames%dspblocksize for jack loop */ 16 22 … … 20 26 21 27 aubio_pvoc_t * pv; 22 23 #ifdef HAVE_JACK24 aubio_jack_t * jack_setup;25 #endif26 28 27 29 int aubio_process(float **input, float **output, int nframes); … … 34 36 /* allocate fft and other memory space */ 35 37 pv = new_aubio_pvoc(win_s,hop_s,channels); 36 /* fill input with some data */37 printf("initialised\n");38 /* execute stft */39 aubio_pvoc_do (pv,in,fftgrain);40 printf("computed forward\n");41 /* execute inverse fourier transform */42 aubio_pvoc_rdo(pv,fftgrain,out);43 printf("computed backard\n");44 38 45 39 #ifdef HAVE_JACK 46 jack_setup = new_aubio_jack(channels, channels, 47 (aubio_process_func_t)aubio_process); 40 aubio_jack_t * jack_setup; 41 jack_setup = new_aubio_jack(channels, channels, 42 midiin, midiout, 43 (aubio_process_func_t)aubio_process); 48 44 aubio_jack_activate(jack_setup); 49 sleep(10); //pause(); /* enter main jack loop */ 45 /* stay in main jack loop for 1 seconds only */ 46 do { 47 sleep(1); 48 } while(testing); 50 49 aubio_jack_close(jack_setup); 51 50 #endif … … 56 55 del_fvec(out); 57 56 aubio_cleanup(); 58 printf("memory freed\n");59 57 return 0; 60 58 } … … 74 72 /* block loop */ 75 73 aubio_pvoc_do (pv,in, fftgrain); 76 //for (i=0;i<fftgrain->length;i++) fftgrain->phas[0][i] *= 2.; 77 //for (i=0;i<fftgrain->length;i++) fftgrain->phas[0][i] = 0.; 74 // zero phases of first channel 75 for (i=0;i<fftgrain->length;i++) fftgrain->phas[0][i] = 0.; 76 // double phases of second channel 77 for (i=0;i<fftgrain->length;i++) { 78 fftgrain->phas[1][i] = 79 aubio_unwrap2pi (fftgrain->phas[1][i] * 2.); 80 } 81 // copy second channel to third one 78 82 aubio_pvoc_rdo(pv,fftgrain,out); 79 83 pos = -1;
Note: See TracChangeset
for help on using the changeset viewer.