Changeset df9df98
- Timestamp:
- Mar 6, 2013, 10:08:25 PM (12 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 6d3777a
- Parents:
- e9436a6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/test-mathutils.c
re9436a6 rdf9df98 27 27 int test_miditofreq() 28 28 { 29 smpl_t midi, freq; 30 for ( midi = 0; midi < 128; midi += 3 ) { 31 freq = aubio_miditofreq(midi); 32 fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq); 29 smpl_t a, b; 30 fprintf(stdout, "b = aubio_miditofreq(a): ["); 31 for ( a = -123.; a < 400.; a += 20. ) { 32 b = aubio_miditofreq(a); 33 fprintf(stdout, "(%.2f, %.2f), ", a, b); 33 34 } 34 midi = 69.5; 35 freq = aubio_miditofreq(midi); 36 fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq); 37 midi = -69.5; 38 freq = aubio_miditofreq(midi); 39 fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq); 40 midi = -169.5; 41 freq = aubio_miditofreq(midi); 42 fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq); 43 midi = 140.; 44 freq = aubio_miditofreq(midi); 45 fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq); 46 midi = 0; 47 freq = aubio_miditofreq(midi); 48 fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq); 49 midi = 8.2e10; 50 freq = aubio_miditofreq(midi); 51 fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq); 52 midi = -5.e10; 53 freq = aubio_miditofreq(midi); 54 fprintf(stdout, "aubio_miditofreq(%.2f) = %.2f\n", midi, freq); 35 b = aubio_miditofreq(a); 36 fprintf(stdout, "(%.2f, %.2f), ", a, b); 37 a = -69.5; 38 b = aubio_miditofreq(a); 39 fprintf(stdout, "(%.2f, %.2f), ", a, b); 40 a = -169.5; 41 b = aubio_miditofreq(a); 42 fprintf(stdout, "(%.2f, %.2f), ", a, b); 43 a = 140.; 44 b = aubio_miditofreq(a); 45 fprintf(stdout, "(%.2f, %.2f), ", a, b); 46 a = 0; 47 b = aubio_miditofreq(a); 48 fprintf(stdout, "(%.2f, %.2f), ", a, b); 49 a = 8.2e10; 50 b = aubio_miditofreq(a); 51 fprintf(stdout, "(%.2f, %.2f), ", a, b); 52 a = -5.e10; 53 fprintf(stdout, "(%.2f, %.2f)", a, b); 54 fprintf(stdout, "]\n"); 55 55 return 0; 56 56 } … … 59 59 { 60 60 smpl_t midi, freq; 61 fprintf(stdout, "b = aubio_freqtomidi(a): ["); 61 62 for ( freq = 0.; freq < 30000.; freq += 440. ) { 62 63 midi = aubio_freqtomidi(freq); 63 fprintf(stdout, " aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);64 fprintf(stdout, "(%.2f, %.2f), ", freq, midi); 64 65 } 65 66 freq = 69.5; 66 67 midi = aubio_freqtomidi(freq); 67 fprintf(stdout, " aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);68 fprintf(stdout, "(%.2f, %.2f), ", freq, midi); 68 69 freq = -69.5; 69 70 midi = aubio_freqtomidi(freq); 70 fprintf(stdout, " aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);71 fprintf(stdout, "(%.2f, %.2f), ", freq, midi); 71 72 freq = -169.5; 72 73 midi = aubio_freqtomidi(freq); 73 fprintf(stdout, " aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);74 fprintf(stdout, "(%.2f, %.2f), ", freq, midi); 74 75 freq = 140.; 75 76 midi = aubio_freqtomidi(freq); 76 fprintf(stdout, " aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);77 fprintf(stdout, "(%.2f, %.2f), ", freq, midi); 77 78 freq = 0; 78 79 midi = aubio_freqtomidi(freq); 79 fprintf(stdout, " aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);80 fprintf(stdout, "(%.2f, %.2f), ", freq, midi); 80 81 freq = 8.2e10; 81 82 midi = aubio_freqtomidi(freq); 82 fprintf(stdout, " aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);83 fprintf(stdout, "(%.2f, %.2f), ", freq, midi); 83 84 freq = -5.; 84 85 midi = aubio_freqtomidi(freq); 85 fprintf(stdout, " aubio_freqtomidi(%.2f) = %.2f\n", freq, midi);86 fprintf(stdout, "(%.2f, %.2f)]\n", freq, midi); 86 87 return 0; 87 88 }
Note: See TracChangeset
for help on using the changeset viewer.