Changeset d5f538f for tests/src/effects
- Timestamp:
- Sep 21, 2016, 4:12:33 PM (8 years ago)
- Branches:
- feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch
- Children:
- ce0dfe9
- Parents:
- 4292013
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/effects/test-pitchshift.c
r4292013 rd5f538f 7 7 sint_t err = 0; 8 8 9 if (argc < 3) {9 if (argc < 4) { 10 10 err = 2; 11 11 PRINT_ERR("not enough arguments\n"); 12 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]); 12 PRINT_MSG("usage: %s <input_path> <output_path> <transpose> [samplerate] [hop_size]\n", argv[0]); 13 PRINT_MSG(" with <transpose> a number of semi tones in the range [-24, 24]\n"); 13 14 return err; 14 15 } … … 17 18 uint_t samplerate = 0; 18 19 uint_t hop_size = 256; 19 smpl_t pitchscale = 1.;20 smpl_t transpose = 0.; 20 21 uint_t n_frames = 0, read = 0; 21 22 … … 23 24 char_t *sink_path = argv[2]; 24 25 25 if ( argc >= 4 ) samplerate = atoi(argv[3]); 26 if ( argc >= 5 ) hop_size = atoi(argv[4]); 27 if ( argc >= 6 ) pitchscale = atof(argv[5]); 26 transpose = atof(argv[3]); 27 28 if ( argc >= 5 ) samplerate = atoi(argv[4]); 29 if ( argc >= 6 ) hop_size = atoi(argv[5]); 28 30 if ( argc >= 7 ) { 29 31 err = 2; … … 44 46 if (!o) { err = 1; goto beach_sink; } 45 47 46 aubio_pitchshift_t *ps = new_aubio_pitchshift("default", pitchscale, hop_size, samplerate);47 //aubio_pitchshift_set_pitchscale(ps, pitchscale);48 aubio_pitchshift_t *ps = new_aubio_pitchshift("default", transpose, hop_size, samplerate); 49 if (!ps) { err = 1; goto beach_pitchshift; } 48 50 49 int k = 0;50 51 do { 51 52 aubio_source_do(i, vec, &read); 52 aubio_pitchshift_set_transpose(ps, (float)(k-50) / 100.);53 //aubio_pitchshift_set_transpose(ps, tranpose); 53 54 aubio_pitchshift_do(ps, vec, out); 54 55 aubio_sink_do(o, out, read); 55 k ++;56 56 n_frames += read; 57 57 } while ( read == hop_size ); … … 62 62 63 63 del_aubio_pitchshift(ps); 64 beach_pitchshift: 64 65 del_aubio_sink(o); 65 66 beach_sink:
Note: See TracChangeset
for help on using the changeset viewer.