Changeset d5f538f for tests/src/effects


Ignore:
Timestamp:
Sep 21, 2016, 4:12:33 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch
Children:
ce0dfe9
Parents:
4292013
Message:

tests/src/effects/test-pitchshift.c: clean-up, use fixed tranposistion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/effects/test-pitchshift.c

    r4292013 rd5f538f  
    77  sint_t err = 0;
    88
    9   if (argc < 3) {
     9  if (argc < 4) {
    1010    err = 2;
    1111    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");
    1314    return err;
    1415  }
     
    1718  uint_t samplerate = 0;
    1819  uint_t hop_size = 256;
    19   smpl_t pitchscale = 1.;
     20  smpl_t transpose = 0.;
    2021  uint_t n_frames = 0, read = 0;
    2122
     
    2324  char_t *sink_path = argv[2];
    2425
    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]);
    2830  if ( argc >= 7 ) {
    2931    err = 2;
     
    4446  if (!o) { err = 1; goto beach_sink; }
    4547
    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; }
    4850
    49   int k = 0;
    5051  do {
    5152    aubio_source_do(i, vec, &read);
    52     aubio_pitchshift_set_transpose(ps, (float)(k-50) / 100.);
     53    //aubio_pitchshift_set_transpose(ps, tranpose);
    5354    aubio_pitchshift_do(ps, vec, out);
    5455    aubio_sink_do(o, out, read);
    55     k ++;
    5656    n_frames += read;
    5757  } while ( read == hop_size );
     
    6262
    6363  del_aubio_pitchshift(ps);
     64beach_pitchshift:
    6465  del_aubio_sink(o);
    6566beach_sink:
Note: See TracChangeset for help on using the changeset viewer.