- Timestamp:
- Dec 5, 2018, 10:34:39 PM (6 years ago)
- Branches:
- feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 283a619a
- Parents:
- 5b46bc3 (diff), f19db54 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- tests/src
- Files:
-
- 3 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tests/src/io/test-sink-multi.c ¶
r5b46bc3 r633400d 1 #define AUBIO_UNSTABLE 12 1 #include <aubio.h> 3 2 #include "utils_tests.h" 4 3 5 // this file uses the unstable aubio api, please use aubio_sink instead6 // see src/io/sink.h and tests/src/sink/test-sink.c4 // same as test-sink.c, but uses aubio_source_do_multi to read multiple 5 // channels 7 6 8 7 int main (int argc, char **argv) … … 11 10 12 11 if (argc < 3) { 13 err = 2;14 PRINT_ERR("not enough arguments\n");12 PRINT_ERR("not enough arguments, running tests\n"); 13 err = run_on_default_source_and_sink(main); 15 14 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [channels] [hop_size]\n", argv[0]); 16 15 return err; -
TabularUnified tests/src/io/test-sink.c ¶
r5b46bc3 r633400d 7 7 8 8 if (argc < 3) { 9 err = 2;10 PRINT_ERR("not enough arguments\n");9 PRINT_ERR("not enough arguments, running tests\n"); 10 err = run_on_default_source_and_sink(main); 11 11 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]); 12 12 return err; -
TabularUnified tests/src/io/test-sink_apple_audio-multi.c ¶
r5b46bc3 r633400d 3 3 #include "utils_tests.h" 4 4 5 // this file uses the unstable aubio api , please use aubio_sink instead6 // see src/io/sink.h and tests/src/sink/test-sink.c5 // this file uses the unstable aubio api to test aubio_sink_apple_audio, please 6 // use aubio_sink instead see src/io/sink.h and tests/src/sink/test-sink.c 7 7 8 8 int main (int argc, char **argv) … … 11 11 12 12 if (argc < 3) { 13 err = 2;14 PRINT_ERR("not enough arguments\n");13 PRINT_ERR("not enough arguments, running tests\n"); 14 err = run_on_default_source_and_sink(main); 15 15 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [channels] [hop_size]\n", argv[0]); 16 16 return err; … … 72 72 beach_source: 73 73 #else /* HAVE_SINK_APPLE_AUDIO */ 74 err = 3;74 err = 0; 75 75 PRINT_ERR("aubio was not compiled with aubio_sink_apple_audio\n"); 76 76 #endif /* HAVE_SINK_APPLE_AUDIO */ -
TabularUnified tests/src/io/test-sink_apple_audio.c ¶
r5b46bc3 r633400d 11 11 12 12 if (argc < 3) { 13 err = 2;14 PRINT_ERR("not enough arguments\n");13 PRINT_ERR("not enough arguments, running tests\n"); 14 err = run_on_default_source_and_sink(main); 15 15 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]); 16 16 return err; … … 61 61 beach_fvec: 62 62 #else /* HAVE_SINK_APPLE_AUDIO */ 63 err = 3;63 err = 0; 64 64 PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n"); 65 65 #endif /* HAVE_SINK_APPLE_AUDIO */ -
TabularUnified tests/src/io/test-sink_sndfile-multi.c ¶
r5b46bc3 r633400d 1 1 #define AUBIO_UNSTABLE 1 2 2 #include <aubio.h> 3 #include "config.h"4 3 #include "utils_tests.h" 5 4 6 // this file uses the unstable aubio api , please use aubio_sink instead7 // see src/io/sink.h and tests/src/sink/test-sink.c5 // this file uses the unstable aubio api to test aubio_sink_sndfile, please 6 // use aubio_sink instead see src/io/sink.h and tests/src/sink/test-sink.c 8 7 9 8 int main (int argc, char **argv) … … 12 11 13 12 if (argc < 3) { 14 err = 2;15 PRINT_ERR("not enough arguments\n");13 PRINT_ERR("not enough arguments, running tests\n"); 14 err = run_on_default_source_and_sink(main); 16 15 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [channels] [hop_size]\n", argv[0]); 17 16 return err; … … 73 72 beach_source: 74 73 #else 75 err = 3;74 err = 0; 76 75 PRINT_ERR("aubio was not compiled with aubio_sink_sndfile\n"); 77 76 #endif /* HAVE_SNDFILE */ -
TabularUnified tests/src/io/test-sink_sndfile.c ¶
r5b46bc3 r633400d 1 1 #define AUBIO_UNSTABLE 1 2 2 #include <aubio.h> 3 #include "config.h"4 3 #include "utils_tests.h" 5 4 … … 12 11 13 12 if (argc < 3) { 14 err = 2;15 PRINT_ERR("not enough arguments\n");13 PRINT_ERR("not enough arguments, running tests\n"); 14 err = run_on_default_source_and_sink(main); 16 15 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]); 17 16 return err; … … 62 61 beach_fvec: 63 62 #else 64 err = 3;63 err = 0; 65 64 PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n"); 66 65 #endif /* HAVE_SNDFILE */ -
TabularUnified tests/src/io/test-sink_wavwrite-multi.c ¶
r5b46bc3 r633400d 3 3 #include "utils_tests.h" 4 4 5 // this file uses the unstable aubio api , please use aubio_sink instead6 // see src/io/sink.h and tests/src/sink/test-sink.c5 // this file uses the unstable aubio api to test aubio_sink_wavwrite, please 6 // use aubio_sink instead see src/io/sink.h and tests/src/sink/test-sink.c 7 7 8 8 int main (int argc, char **argv) … … 11 11 12 12 if (argc < 3) { 13 err = 2;14 PRINT_ERR("not enough arguments\n");13 PRINT_ERR("not enough arguments, running tests\n"); 14 err = run_on_default_source_and_sink(main); 15 15 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [channels] [hop_size]\n", argv[0]); 16 16 return err; … … 72 72 beach_source: 73 73 #else 74 err = 3;74 err = 0; 75 75 PRINT_ERR("aubio was not compiled with aubio_sink_wavwrite\n"); 76 76 #endif /* HAVE_WAVWRITE */ -
TabularUnified tests/src/io/test-sink_wavwrite.c ¶
r5b46bc3 r633400d 11 11 12 12 if (argc < 3) { 13 err = 2;14 PRINT_ERR("not enough arguments\n");13 PRINT_ERR("not enough arguments, running tests\n"); 14 err = run_on_default_source_and_sink(main); 15 15 PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]); 16 16 return err; … … 61 61 beach_fvec: 62 62 #else 63 err = 3;63 err = 0; 64 64 PRINT_ERR("aubio was not compiled with aubio_sink_wavwrite\n"); 65 65 #endif /* HAVE_WAVWRITE */ -
TabularUnified tests/src/io/test-source.c ¶
r5b46bc3 r633400d 6 6 uint_t err = 0; 7 7 if (argc < 2) { 8 err = 2;9 PRINT_ERR("not enough arguments\n");8 PRINT_ERR("not enough arguments, running tests\n"); 9 err = run_on_default_source(main); 10 10 PRINT_MSG("read a wave file as a mono vector\n"); 11 11 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); … … 23 23 uint_t hop_size = 256; 24 24 uint_t n_frames = 0, read = 0; 25 if ( argc == 3 ) samplerate = atoi(argv[2]);26 if ( argc == 4 ) hop_size = atoi(argv[3]);25 if ( argc >= 3 ) samplerate = atoi(argv[2]); 26 if ( argc >= 4 ) hop_size = atoi(argv[3]); 27 27 28 28 char_t *source_path = argv[1]; -
TabularUnified tests/src/io/test-source_apple_audio.c ¶
r5b46bc3 r633400d 10 10 uint_t err = 0; 11 11 if (argc < 2) { 12 err = 2;13 PRINT_ERR("not enough arguments\n");12 PRINT_ERR("not enough arguments, running tests\n"); 13 err = run_on_default_source(main); 14 14 PRINT_MSG("read a wave file as a mono vector\n"); 15 15 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); … … 28 28 uint_t hop_size = 256; 29 29 uint_t n_frames = 0, read = 0; 30 if ( argc == 3 ) samplerate = atoi(argv[2]);31 if ( argc == 4 ) hop_size = atoi(argv[3]);30 if ( argc >= 3 ) samplerate = atoi(argv[2]); 31 if ( argc >= 4 ) hop_size = atoi(argv[3]); 32 32 33 33 char_t *source_path = argv[1]; … … 57 57 beach: 58 58 #else /* HAVE_SOURCE_APPLE_AUDIO */ 59 err = 3;59 err = 0; 60 60 PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n"); 61 61 #endif /* HAVE_SOURCE_APPLE_AUDIO */ -
TabularUnified tests/src/io/test-source_avcodec.c ¶
r5b46bc3 r633400d 10 10 uint_t err = 0; 11 11 if (argc < 2) { 12 err = 2;13 PRINT_ERR("not enough arguments\n");12 PRINT_ERR("not enough arguments, running tests\n"); 13 err = run_on_default_source(main); 14 14 PRINT_MSG("read a wave file as a mono vector\n"); 15 15 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); … … 28 28 uint_t hop_size = 256; 29 29 uint_t n_frames = 0, read = 0; 30 if ( argc == 3 ) samplerate = atoi(argv[2]);31 if ( argc == 4 ) hop_size = atoi(argv[3]);30 if ( argc >= 3 ) samplerate = atoi(argv[2]); 31 if ( argc >= 4 ) hop_size = atoi(argv[3]); 32 32 33 33 char_t *source_path = argv[1]; … … 57 57 beach: 58 58 #else /* HAVE_LIBAV */ 59 err = 3;59 err = 0; 60 60 PRINT_ERR("aubio was not compiled with aubio_source_avcodec\n"); 61 61 #endif /* HAVE_LIBAV */ -
TabularUnified tests/src/io/test-source_multi.c ¶
r5b46bc3 r633400d 6 6 sint_t err = 0; 7 7 if (argc < 2) { 8 err = -2;9 PRINT_ERR("not enough arguments\n");8 PRINT_ERR("not enough arguments, running tests\n"); 9 err = run_on_default_source(main); 10 10 PRINT_MSG("read a wave file as a mono vector\n"); 11 11 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); -
TabularUnified tests/src/io/test-source_seek.c ¶
r5b46bc3 r633400d 6 6 uint_t err = 0; 7 7 if (argc < 2) { 8 err = 2;9 PRINT_ERR("not enough arguments\n");8 PRINT_ERR("not enough arguments, running tests\n"); 9 err = run_on_default_source(main); 10 10 PRINT_MSG("read a wave file as a mono vector\n"); 11 11 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); … … 24 24 uint_t n_frames = 0, read = 0; 25 25 uint_t old_n_frames_1 = 0, old_n_frames_2 = 0, old_n_frames_3 = 0; 26 if ( argc == 3 ) samplerate = atoi(argv[2]);27 if ( argc == 4 ) hop_size = atoi(argv[3]);26 if ( argc >= 3 ) samplerate = atoi(argv[2]); 27 if ( argc >= 4 ) hop_size = atoi(argv[3]); 28 28 29 29 char_t *source_path = argv[1]; -
TabularUnified tests/src/io/test-source_sndfile.c ¶
r5b46bc3 r633400d 10 10 uint_t err = 0; 11 11 if (argc < 2) { 12 err = 2;13 PRINT_ERR("not enough arguments\n");12 PRINT_ERR("not enough arguments, running tests\n"); 13 err = run_on_default_source(main); 14 14 PRINT_MSG("read a wave file as a mono vector\n"); 15 15 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); … … 28 28 uint_t hop_size = 256; 29 29 uint_t n_frames = 0, read = 0; 30 if ( argc == 3 ) samplerate = atoi(argv[2]);31 if ( argc == 4 ) hop_size = atoi(argv[3]);30 if ( argc >= 3 ) samplerate = atoi(argv[2]); 31 if ( argc >= 4 ) hop_size = atoi(argv[3]); 32 32 33 33 char_t *source_path = argv[1]; … … 57 57 beach: 58 58 #else 59 err = 3;59 err = 0; 60 60 PRINT_ERR("aubio was not compiled with aubio_source_sndfile\n"); 61 61 #endif /* HAVE_SNDFILE */ -
TabularUnified tests/src/io/test-source_wavread.c ¶
r5b46bc3 r633400d 10 10 uint_t err = 0; 11 11 if (argc < 2) { 12 err = 2;13 PRINT_ERR("not enough arguments\n");12 PRINT_ERR("not enough arguments, running tests\n"); 13 err = run_on_default_source(main); 14 14 PRINT_MSG("read a wave file as a mono vector\n"); 15 15 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); … … 28 28 uint_t hop_size = 256; 29 29 uint_t n_frames = 0, read = 0; 30 if ( argc == 3 ) samplerate = atoi(argv[2]);31 if ( argc == 4 ) hop_size = atoi(argv[3]);30 if ( argc >= 3 ) samplerate = atoi(argv[2]); 31 if ( argc >= 4 ) hop_size = atoi(argv[3]); 32 32 33 33 char_t *source_path = argv[1]; … … 36 36 aubio_source_wavread_t * s = 37 37 new_aubio_source_wavread(source_path, samplerate, hop_size); 38 39 38 if (!s) { err = 1; goto beach; } 40 39 fvec_t *vec = new_fvec(hop_size); … … 58 57 beach: 59 58 #else 60 err = 3;59 err = 0; 61 60 PRINT_ERR("aubio was not compiled with aubio_source_wavread\n"); 62 61 #endif /* HAVE_WAVREAD */ -
TabularUnified tests/src/onset/test-onset.c ¶
r5b46bc3 r633400d 1 1 #include <aubio.h> 2 2 #include "utils_tests.h" 3 4 int test_wrong_params(void); 3 5 4 6 int main (int argc, char **argv) … … 7 9 if (argc < 2) { 8 10 err = 2; 9 PRINT_ ERR("not enough arguments\n");10 PRINT_MSG("read a wave file as a mono vector\n");11 PRINT_WRN("no arguments, running tests\n"); 12 err = test_wrong_params(); 11 13 PRINT_MSG("usage: %s <source_path> [samplerate] [hop_size]\n", argv[0]); 12 14 return err; … … 16 18 uint_t hop_size = win_s / 4; 17 19 uint_t n_frames = 0, read = 0; 18 if ( argc == 3 ) samplerate = atoi(argv[2]);19 if ( argc == 4 ) hop_size = atoi(argv[3]);20 if ( argc >= 3 ) samplerate = atoi(argv[2]); 21 if ( argc >= 4 ) hop_size = atoi(argv[3]); 20 22 21 23 char_t *source_path = argv[1]; … … 61 63 return err; 62 64 } 65 66 int test_wrong_params(void) 67 { 68 uint_t win_size = 1024; 69 uint_t hop_size = win_size / 2; 70 uint_t samplerate = 44100; 71 // hop_size < 1 72 if (new_aubio_onset("default", 5, 0, samplerate)) 73 return 1; 74 // buf_size < 2 75 if (new_aubio_onset("default", 1, 1, samplerate)) 76 return 1; 77 // buf_size < hop_size 78 if (new_aubio_onset("default", hop_size, win_size, samplerate)) 79 return 1; 80 // samplerate < 1 81 if (new_aubio_onset("default", 1024, 512, 0)) 82 return 1; 83 84 // specdesc creation failed 85 if (new_aubio_onset("abcd", win_size, win_size/2, samplerate)) 86 return 1; 87 88 aubio_onset_t *o; 89 90 // pv creation might fail 91 o = new_aubio_onset("default", 5, 2, samplerate); 92 if (o) del_aubio_onset(o); 93 94 o = new_aubio_onset("default", win_size, hop_size, samplerate); 95 if (!aubio_onset_set_default_parameters(o, "wrong_type")) 96 return 1; 97 del_aubio_onset(o); 98 99 return run_on_default_source(main); 100 } -
TabularUnified tests/src/pitch/test-pitch.c ¶
r5b46bc3 r633400d 31 31 aubio_cleanup (); 32 32 33 if (new_aubio_pitch(0, win_s, hop_s, samplerate)) return 1; 34 if (new_aubio_pitch("unknown", win_s, hop_s, samplerate)) return 1; 35 if (new_aubio_pitch("default", win_s, 0, samplerate)) return 1; 36 if (new_aubio_pitch("default", 0, hop_s, samplerate)) return 1; 37 if (new_aubio_pitch("default", hop_s, win_s, samplerate)) return 1; 38 if (new_aubio_pitch("default", win_s, hop_s, 0)) return 1; 39 40 o = new_aubio_pitch("default", win_s, hop_s, samplerate); 41 42 if (aubio_pitch_set_unit(o, "freq")) return 1; 43 if (aubio_pitch_set_unit(o, "hertz")) return 1; 44 if (aubio_pitch_set_unit(o, "Hertz")) return 1; 45 if (aubio_pitch_set_unit(o, "Hz")) return 1; 46 if (aubio_pitch_set_unit(o, "f0")) return 1; 47 if (aubio_pitch_set_unit(o, "midi")) return 1; 48 if (aubio_pitch_set_unit(o, "cent")) return 1; 49 if (aubio_pitch_set_unit(o, "bin")) return 1; 50 if (!aubio_pitch_set_unit(o, "unknown")) return 1; 51 52 if (aubio_pitch_set_tolerance(o, 0.3)) return 1; 53 if (aubio_pitch_set_silence(o, 0)) return 1; 54 if (aubio_pitch_set_silence(o, -200)) return 1; 55 if (!aubio_pitch_set_silence(o, -300)) return 1; 56 del_aubio_pitch(o); 57 58 // fft based might fail with non power of 2 59 o = new_aubio_pitch("yinfft", win_s + 1, hop_s, samplerate); 60 if (o) del_aubio_pitch(o); 61 o = new_aubio_pitch("yinfast", win_s + 1, hop_s, samplerate); 62 if (o) del_aubio_pitch(o); 63 o = new_aubio_pitch("fcomb", win_s + 1, hop_s, samplerate); 64 if (o) del_aubio_pitch(o); 65 o = new_aubio_pitch("mcomb", win_s + 1, hop_s, samplerate); 66 if (o) del_aubio_pitch(o); 67 o = new_aubio_pitch("specacf", win_s + 1, hop_s, samplerate); 68 if (o) del_aubio_pitch(o); 69 33 70 return 0; 34 71 } -
TabularUnified tests/src/spectral/test-filterbank.c ¶
r5b46bc3 r633400d 9 9 fvec_t *out_filters = new_fvec (n_filters); // per-band outputs 10 10 11 if (new_aubio_filterbank(0, win_s)) return 1; 12 if (new_aubio_filterbank(n_filters, 0)) return 1; 13 11 14 // create filterbank object 12 15 aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s); 16 17 smpl_t power = aubio_filterbank_get_power(o); 18 smpl_t norm = aubio_filterbank_get_norm(o); 19 if (aubio_filterbank_set_power(o, power)) { 20 return 1; 21 } 22 if (aubio_filterbank_set_norm(o, norm)) { 23 return 1; 24 } 13 25 14 26 // apply filterbank ten times -
TabularUnified tests/src/spectral/test-mfcc.c ¶
r5b46bc3 r633400d 5 5 uint_t win_s = 512; // fft size 6 6 uint_t n_filters = 40; // number of filters 7 uint_t n_coef s = 13; // number of coefficients7 uint_t n_coeffs = 13; // number of coefficients 8 8 smpl_t samplerate = 16000.; // samplerate 9 9 cvec_t *in = new_cvec (win_s); // input buffer 10 fvec_t *out = new_fvec (n_coefs); // output coefficients 10 fvec_t *out = new_fvec (n_coeffs); // output coefficients 11 12 if (new_aubio_mfcc( 0, n_filters, n_coeffs, samplerate)) return 1; 13 if (new_aubio_mfcc(win_s, 0, n_coeffs, samplerate)) return 1; 14 if (new_aubio_mfcc(win_s, n_filters, 0, samplerate)) return 1; 15 if (new_aubio_mfcc(win_s, n_filters, n_coeffs, 0)) return 1; 11 16 12 17 // create mfcc object 13 aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coef s, samplerate);18 aubio_mfcc_t *o = new_aubio_mfcc (win_s, n_filters, n_coeffs, samplerate); 14 19 15 20 cvec_norm_set_all (in, 1.); -
TabularUnified tests/src/spectral/test-phasevoc.c ¶
r5b46bc3 r633400d 13 13 // allocate fft and other memory space 14 14 aubio_pvoc_t * pv = new_aubio_pvoc(win_s,hop_s); 15 16 if (new_aubio_pvoc(win_s, 0)) return 1; 17 18 if (aubio_pvoc_get_win(pv) != win_s) return 1; 19 if (aubio_pvoc_get_hop(pv) != hop_s) return 1; 20 21 if (aubio_pvoc_set_window(pv, "hanningz") != 0) return 1; 15 22 16 23 // fill input with some data … … 29 36 cvec_print (fftgrain); 30 37 31 // option naly rebuild the signa38 // optionally rebuild the signal 32 39 aubio_pvoc_rdo(pv,fftgrain,out); 33 40 -
TabularUnified tests/src/spectral/test-tss.c ¶
r5b46bc3 r633400d 35 35 } 36 36 37 aubio_tss_set_alpha(tss, 4.); 38 aubio_tss_set_beta(tss, 3.); 39 aubio_tss_set_threshold(tss, 3.); 40 37 41 del_aubio_pvoc(pv); 38 42 del_aubio_pvoc(pvt); -
TabularUnified tests/src/synth/test-sampler.c ¶
r5b46bc3 r633400d 1 #include <string.h> // strncpy 2 #include <limits.h> // PATH_MAX 1 3 #include <aubio.h> 2 4 #include "utils_tests.h" … … 6 8 sint_t err = 0; 7 9 8 if (argc < 4) {9 err = 2;10 PRINT_ERR("not enough arguments\n");10 if (argc < 3) { 11 PRINT_ERR("not enough arguments, running tests\n"); 12 err = run_on_default_source_and_sink(main); 11 13 PRINT_MSG("usage: %s <input_path> <output_path> <sample_path> [samplerate]\n", argv[0]); 12 14 return err; … … 19 21 char_t *source_path = argv[1]; 20 22 char_t *sink_path = argv[2]; 21 char_t *sample_path = argv[3]; 22 if ( argc == 5 ) samplerate = atoi(argv[4]); 23 char_t sample_path[PATH_MAX]; 24 if ( argc >= 4 ) { 25 strncpy(sample_path, argv[3], PATH_MAX - 1); 26 } else { 27 // use input_path as sample 28 strncpy(sample_path, source_path, PATH_MAX - 1); 29 } 30 sample_path[PATH_MAX - 1] = '\0'; 31 if ( argc >= 5 ) samplerate = atoi(argv[4]); 23 32 24 33 fvec_t *vec = new_fvec(hop_size); -
TabularUnified tests/src/synth/test-wavetable.c ¶
r5b46bc3 r633400d 7 7 8 8 if (argc < 2) { 9 err = 2;10 PRINT_ERR("not enough arguments\n");9 PRINT_ERR("not enough arguments, running tests\n"); 10 err = run_on_default_sink(main); 11 11 PRINT_MSG("usage: %s <output_path> [freq] [samplerate]\n", argv[0]); 12 12 return err; … … 18 18 19 19 char_t *sink_path = argv[1]; 20 if ( argc == 4 ) samplerate = atoi(argv[3]);21 if ( argc == 3 ) freq = atof(argv[2]);20 if ( argc >= 4 ) samplerate = atoi(argv[3]); 21 if ( argc >= 3 ) freq = atof(argv[2]); 22 22 23 23 fvec_t *vec = new_fvec(hop_size); -
TabularUnified tests/src/tempo/test-tempo.c ¶
r5b46bc3 r633400d 1 1 #include <aubio.h> 2 2 #include "utils_tests.h" 3 4 int test_wrong_params(void); 3 5 4 6 int main (int argc, char **argv) … … 6 8 uint_t err = 0; 7 9 if (argc < 2) { 8 err = 2;9 PRINT_ERR("not enough arguments\n");10 PRINT_MSG(" read a wave file as a mono vector\n");11 PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n",argv[0]);10 PRINT_WRN("no arguments, running tests\n"); 11 err = test_wrong_params(); 12 PRINT_MSG("usage: %s <source_path> [samplerate] [win_size] [hop_size]\n", 13 argv[0]); 12 14 return err; 13 15 } … … 21 23 22 24 char_t *source_path = argv[1]; 23 aubio_source_t * source = new_aubio_source(source_path, samplerate, hop_size); 25 aubio_source_t * source = new_aubio_source(source_path, samplerate, 26 hop_size); 24 27 if (!source) { err = 1; goto beach; } 25 28 … … 31 34 32 35 // create tempo object 33 aubio_tempo_t * o = new_aubio_tempo("default", win_size, hop_size, samplerate); 36 aubio_tempo_t * o = new_aubio_tempo("default", win_size, hop_size, 37 samplerate); 38 39 if (!o) { err = 1; goto beach_tempo; } 34 40 35 41 do { … … 40 46 // do something with the beats 41 47 if (out->data[0] != 0) { 42 PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2fbpm with confidence %.2f\n", 48 PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2f bpm " 49 "with confidence %.2f\n", 43 50 aubio_tempo_get_last_ms(o), aubio_tempo_get_last_s(o), 44 aubio_tempo_get_last(o), aubio_tempo_get_bpm(o), aubio_tempo_get_confidence(o)); 51 aubio_tempo_get_last(o), aubio_tempo_get_bpm(o), 52 aubio_tempo_get_confidence(o)); 45 53 } 46 54 n_frames += read; … … 54 62 // clean up memory 55 63 del_aubio_tempo(o); 64 beach_tempo: 56 65 del_fvec(in); 57 66 del_fvec(out); … … 62 71 return err; 63 72 } 73 74 int test_wrong_params(void) 75 { 76 uint_t win_size = 1024; 77 uint_t hop_size = 256; 78 uint_t samplerate = 44100; 79 aubio_tempo_t *t; 80 fvec_t* in, *out; 81 uint_t i; 82 83 // test wrong method fails 84 if (new_aubio_tempo("unexisting_method", win_size, hop_size, samplerate)) 85 return 1; 86 87 // test hop > win fails 88 if (new_aubio_tempo("default", hop_size, win_size, samplerate)) 89 return 1; 90 91 // test null hop_size fails 92 if (new_aubio_tempo("default", win_size, 0, samplerate)) 93 return 1; 94 95 // test 1 buf_size fails 96 if (new_aubio_tempo("default", 1, 1, samplerate)) 97 return 1; 98 99 // test null samplerate fails 100 if (new_aubio_tempo("default", win_size, hop_size, 0)) 101 return 1; 102 103 // test short sizes workaround 104 t = new_aubio_tempo("default", 2048, 2048, 500); 105 if (!t) 106 return 1; 107 108 del_aubio_tempo(t); 109 110 t = new_aubio_tempo("default", win_size, hop_size, samplerate); 111 if (!t) 112 return 1; 113 114 in = new_fvec(hop_size); 115 out = new_fvec(1); 116 117 // up to step = (next_power_of_two(5.8 * samplerate / hop_size ) / 4 ) 118 for (i = 0; i < 256 + 1; i++) 119 { 120 aubio_tempo_do(t,in,out); 121 PRINT_MSG("beat at %.3fms, %.3fs, frame %d, %.2f bpm " 122 "with confidence %.2f, was tatum %d\n", 123 aubio_tempo_get_last_ms(t), aubio_tempo_get_last_s(t), 124 aubio_tempo_get_last(t), aubio_tempo_get_bpm(t), 125 aubio_tempo_get_confidence(t), aubio_tempo_was_tatum(t)); 126 } 127 128 del_aubio_tempo(t); 129 del_fvec(in); 130 del_fvec(out); 131 132 return run_on_default_source(main); 133 } -
TabularUnified tests/src/temporal/test-filter.c ¶
r5b46bc3 r633400d 9 9 10 10 aubio_filter_t *o = new_aubio_filter_c_weighting (44100); 11 12 if (new_aubio_filter(0)) 13 return 1; 14 15 if (aubio_filter_get_samplerate(o) != 44100) 16 return 1; 17 18 if (aubio_filter_set_c_weighting (o, -1) == 0) 19 return 1; 20 21 if (aubio_filter_set_c_weighting (0, 32000) == 0) 22 return 1; 23 11 24 in->data[impulse_at] = 0.5; 12 25 fvec_print (in); … … 16 29 17 30 o = new_aubio_filter_a_weighting (32000); 31 32 if (aubio_filter_set_a_weighting (o, -1) == 0) 33 return 1; 34 if (aubio_filter_set_a_weighting (0, 32000) == 0) 35 return 1; 36 18 37 in->data[impulse_at] = 0.5; 19 38 fvec_print (in); -
TabularUnified tests/src/test-mathutils.c ¶
r5b46bc3 r633400d 103 103 104 104 window_size /= 2.; 105 window = new_aubio_window(" triangle", window_size);105 window = new_aubio_window("parzen", window_size); 106 106 fvec_print(window); 107 107 del_fvec(window); … … 117 117 test_miditofreq(); 118 118 test_freqtomidi(); 119 test_aubio_window(); 119 120 return 0; 120 121 } -
TabularUnified tests/src/utils/test-hist.c ¶
r5b46bc3 r633400d 26 26 del_fvec(t); 27 27 } 28 if (new_aubio_hist(0, 1, 0)) return 1; 28 29 return 0; 29 30 } -
TabularUnified tests/src/utils/test-log.c ¶
r5b46bc3 r633400d 10 10 void logging(int level, const char_t *message, void *data) { 11 11 FILE *out; 12 fprintf(stdout, "using custom logging function\n");12 //fprintf(stdout, "using custom logging function\n"); 13 13 if (level == AUBIO_LOG_ERR) { 14 14 out = stderr; … … 26 26 fprintf(stdout, "### testing normal logging\n"); 27 27 AUBIO_ERR("testing normal AUBIO_LOG_ERR\n"); 28 AUBIO_INF("testing normal AUBIO_LOG_INF\n"); 28 29 AUBIO_WRN("testing normal AUBIO_LOG_WRN\n"); 29 30 AUBIO_MSG("testing normal AUBIO_LOG_MSG\n"); … … 32 33 fprintf(stdout, "### testing with one custom function\n"); 33 34 aubio_log_set_function(logging, (void *)hdr); 34 AUBIO_ERR("testing recustom AUBIO_LOG_ERR\n"); 35 AUBIO_WRN("testing recustom AUBIO_LOG_WRN\n"); 36 AUBIO_MSG("testing recustom AUBIO_LOG_MSG\n"); 37 AUBIO_DBG("testing recustom AUBIO_LOG_DBG\n"); 35 AUBIO_ERR("testing custom set_function AUBIO_LOG_ERR\n"); 36 AUBIO_INF("testing custom set_function AUBIO_LOG_INF\n"); 37 AUBIO_WRN("testing custom set_function AUBIO_LOG_WRN\n"); 38 AUBIO_MSG("testing custom set_function AUBIO_LOG_MSG\n"); 39 AUBIO_DBG("testing custom set_function AUBIO_LOG_DBG\n"); 38 40 39 41 fprintf(stdout, "### testing resetted logging\n"); 40 42 aubio_log_reset(); 41 AUBIO_ERR("testing uncustom AUBIO_LOG_ERR\n"); 42 AUBIO_WRN("testing uncustom AUBIO_LOG_WRN\n"); 43 AUBIO_MSG("testing uncustom AUBIO_LOG_MSG\n"); 44 AUBIO_DBG("testing uncustom AUBIO_LOG_DBG\n"); 43 AUBIO_ERR("testing again normal AUBIO_LOG_ERR\n"); 44 AUBIO_INF("testing again normal AUBIO_LOG_INF\n"); 45 AUBIO_WRN("testing again normal AUBIO_LOG_WRN\n"); 46 AUBIO_MSG("testing again normal AUBIO_LOG_MSG\n"); 47 AUBIO_DBG("testing again normal AUBIO_LOG_DBG\n"); 45 48 46 49 fprintf(stdout, "### testing per level customization\n"); … … 48 51 aubio_log_set_level_function(AUBIO_LOG_WRN, logging, NULL); 49 52 aubio_log_set_level_function(AUBIO_LOG_MSG, logging, (void *)hdr); 50 AUBIO_ERR("testing custom AUBIO_LOG_ERR\n"); 51 AUBIO_WRN("testing custom AUBIO_LOG_WRN with data=NULL\n"); 52 AUBIO_MSG("testing custom AUBIO_LOG_MSG\n"); 53 AUBIO_DBG("testing uncustomized AUBIO_LOG_DBG\n"); 53 AUBIO_ERR("testing custom set_level_function AUBIO_LOG_ERR\n"); 54 AUBIO_INF("testing again normal AUBIO_LOG_INF\n"); 55 AUBIO_WRN("testing custom set_level_function AUBIO_LOG_WRN with data=NULL\n"); 56 AUBIO_MSG("testing custom set_level_function AUBIO_LOG_MSG\n"); 57 AUBIO_DBG("testing again normal AUBIO_LOG_DBG\n"); 54 58 55 59 return 0;
Note: See TracChangeset
for help on using the changeset viewer.