Changeset f50e534 for tests


Ignore:
Timestamp:
Mar 5, 2013, 6:33:41 AM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
208336b
Parents:
a4cc8e5
Message:

tests/src/io/test-source.c: default to source samplerate, add hop_size option, print number of frames read

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/io/test-source.c

    ra4cc8e5 rf50e534  
    88    err = 2;
    99    PRINT_ERR("not enough arguments\n");
    10     PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]);
     10    PRINT_MSG("read a wave file as a mono vector\n");
     11    PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]);
     12    PRINT_MSG("examples:\n");
     13    PRINT_MSG(" - read file.wav at original samplerate\n");
     14    PRINT_MSG("       %s file.wav\n", argv[0]);
     15    PRINT_MSG(" - read file.wav at 32000Hz\n");
     16    PRINT_MSG("       %s file.aif 32000\n", argv[0]);
     17    PRINT_MSG(" - read file.wav at original samplerate with 4096 blocks\n");
     18    PRINT_MSG("       %s file.wav 0 4096 \n", argv[0]);
    1119    return err;
    1220  }
    1321
    14   uint_t samplerate = 32000;
     22  uint_t samplerate = 0;
    1523  uint_t hop_size = 256;
    1624  uint_t n_frames = 0, read = 0;
    1725  if ( argc == 3 ) samplerate = atoi(argv[2]);
     26  if ( argc == 4 ) hop_size = atoi(argv[3]);
    1827
    1928  char_t *source_path = argv[1];
     
    3140  } while ( read == hop_size );
    3241
     42  PRINT_MSG("read %d frames at %dHz (%d blocks) from %s\n", n_frames, samplerate,
     43    n_frames / hop_size, source_path);
     44
    3345beach:
    3446  del_aubio_source (s);
Note: See TracChangeset for help on using the changeset viewer.