Changeset e7d4aa0 for tests/src/effects/test-timestretch.c
- Timestamp:
- Dec 7, 2018, 1:28:56 AM (6 years ago)
- Branches:
- feature/cnn, feature/crepe, feature/timestretch, fix/ffmpeg5, master
- Children:
- 9b0ffe3
- Parents:
- 284fe8a
- git-author:
- Paul Brossier <piem@piem.org> (11/28/16 15:40:57)
- git-committer:
- Paul Brossier <piem@piem.org> (12/07/18 01:28:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/effects/test-timestretch.c
r284fe8a re7d4aa0 22 22 smpl_t stretch = 1.; 23 23 uint_t n_frames = 0, read = 0; 24 uint_t eof = 0, source_read = 0; 24 25 25 26 char_t *source_path = argv[1]; … … 39 40 } 40 41 42 uint_t source_hopsize = 2048; 43 aubio_source_t *s = new_aubio_source(source_path, samplerate, source_hopsize); 44 if (!s) { err = 1; goto beach_source; } 45 if (samplerate == 0) samplerate = aubio_source_get_samplerate(s); 46 47 fvec_t *in = new_fvec(source_hopsize); 41 48 fvec_t *out = new_fvec(hop_size); 42 49 if (!out) { err = 1; goto beach_fvec; } 43 50 44 aubio_timestretch_t *ps = new_aubio_timestretch( source_path, mode,45 s tretch, hop_size, samplerate);51 aubio_timestretch_t *ps = new_aubio_timestretch(mode, stretch, hop_size, 52 samplerate); 46 53 if (!ps) { err = 1; goto beach_timestretch; } 47 if (samplerate == 0 ) samplerate = aubio_timestretch_get_samplerate(ps);54 //if (samplerate == 0 ) samplerate = aubio_timestretch_get_samplerate(ps); 48 55 49 56 aubio_sink_t *o = new_aubio_sink(sink_path, samplerate); … … 52 59 if (transpose != 0) aubio_timestretch_set_transpose(ps, transpose); 53 60 61 do { 62 //aubio_timestretch_set_stretch(ps, stretch); 63 //aubio_timestretch_set_transpose(ps, transpose); 64 65 while (aubio_timestretch_get_available(ps) < (sint_t)hop_size && !eof) { 66 aubio_source_do(s, in, &source_read); 67 aubio_timestretch_push(ps, in, source_read); 68 if (source_read < in->length) eof = 1; 69 } 54 70 #if 0 55 do { 56 if (aubio_timestretch_get_opened(ps) == 0) 57 PRINT_MSG("not opened!\n"); 58 aubio_timestretch_get_opened(ps); 59 aubio_timestretch_set_stretch(ps, stretch); 60 aubio_timestretch_set_transpose(ps, transpose); 71 if (n_frames == hop_size * 200) { 72 PRINT_MSG("sampler: setting stretch gave %d\n", 73 aubio_timestretch_set_stretch(ps, 2.) ); 74 PRINT_MSG("sampler: getting stretch gave %f\n", 75 aubio_timestretch_get_stretch(ps) ); 76 PRINT_MSG("sampler: setting transpose gave %d\n", 77 aubio_timestretch_set_transpose(ps, 12.) ); 78 PRINT_MSG("sampler: getting transpose gave %f\n", 79 aubio_timestretch_get_transpose(ps) ); 80 } 81 #endif 61 82 aubio_timestretch_do(ps, out, &read); 62 if (samplerate == 0) {63 PRINT_MSG("setting samplerate now to %d\n", aubio_timestretch_get_samplerate(ps));64 samplerate = aubio_timestretch_get_samplerate(ps);65 aubio_sink_preset_samplerate(o, samplerate);66 aubio_sink_preset_channels(o, 1);67 }68 83 aubio_sink_do(o, out, read); 69 84 n_frames += read; 70 85 } while ( read == hop_size ); 71 #else72 73 aubio_timestretch_queue(ps, source_path, samplerate);74 75 do {76 aubio_timestretch_get_opened(ps);77 aubio_timestretch_set_stretch(ps, stretch);78 aubio_timestretch_set_transpose(ps, transpose);79 aubio_timestretch_do(ps, out, &read);80 if (n_frames == 34999 * hop_size) {81 PRINT_MSG("instant queuing?\n");82 aubio_timestretch_queue(ps, source_path, samplerate);83 }84 if (n_frames == 64999 * hop_size) {85 PRINT_MSG("instant queuing 2\n");86 aubio_timestretch_queue(ps, "/dev/null", samplerate);87 }88 if (n_frames == 54999 * hop_size) {89 PRINT_MSG("instant queuing?\n");90 aubio_timestretch_queue(ps, source_path, samplerate);91 }92 if (n_frames == 74999 * hop_size) {93 PRINT_MSG("instant queuing?\n");94 aubio_timestretch_queue(ps, source_path, samplerate);95 }96 aubio_sink_do(o, out, read);97 //} while ( read == hop_size );98 n_frames += hop_size;99 } while ( n_frames < 100000 * hop_size);100 #endif101 86 102 87 PRINT_MSG("wrote %d frames at %dHz (%d blocks) from %s written to %s\n", … … 110 95 del_fvec(out); 111 96 beach_fvec: 97 del_aubio_source(s); 98 beach_source: 112 99 return err; 113 100 }
Note: See TracChangeset
for help on using the changeset viewer.