testmain.cpp (1827B)
1 2 #include <stdlib.h> 3 #include <stdio.h> 4 #include <stdint.h> 5 #include <string.h> 6 #include <math.h> 7 #include <algorithm> 8 9 // // #include "util/math.hpp" // Rack 10 // #include "simd/vector.hpp" // Rack 11 // using rack::simd::float_4; 12 // 13 // // #include "dsp/fixed.hpp" 14 // // using namespace bogaudio::dsp; 15 // 16 // int main() { 17 // // { 18 // // fixed_16_16 x = 5; 19 // // fixed_16_16 y = 1; 20 // // x = 3; 21 // // printf("X=%d\n", (int)(x + y)); 22 // // y = 2; 23 // // printf("X=%d\n", (int)(x - y)); 24 // // x = y + 5; 25 // // printf("X=%d\n", (int)x); 26 // // x = y - 3; 27 // // printf("X=%d\n", (int)x); 28 // // 29 // // x += 2.5; 30 // // printf("X=%d\n", (int)x); 31 // // printf("X=%f\n", (float)x); 32 // // 33 // // x = y - 0.3; 34 // // printf("X=%d\n", (int)x); 35 // // printf("X=%f\n", (float)x); 36 // // } 37 // // 38 // // { 39 // // fixed_32_32 x = 5; 40 // // fixed_32_32 y = 1; 41 // // x = 3; 42 // // printf("X=%d\n", (int)(x + y)); 43 // // y = 2; 44 // // printf("X=%d\n", (int)(x - y)); 45 // // x = y + 5; 46 // // printf("X=%d\n", (int)x); 47 // // x = y - 3; 48 // // printf("X=%d\n", (int)x); 49 // // 50 // // x += 2.5; 51 // // printf("X=%d\n", (int)x); 52 // // printf("X=%f\n", (float)x); 53 // // 54 // // x = y - 0.3; 55 // // printf("X=%d\n", (int)x); 56 // // printf("X=%f\n", (float)x); 57 // // } 58 // // 59 // // return 0; 60 // 61 // float_4 a(1.0, 2.0, 3.0, 4.0); 62 // float_4 b = _mm_shuffle_ps(a.v, a.v, _MM_SHUFFLE(2, 1, 0, 0)); 63 // b[0] = 0.0; 64 // for (int i = 0; i < 4; ++i) { 65 // printf("a=%f b=%f\n", a[i], b[i]); 66 // } 67 // } 68 69 #include "dsp/pitch.hpp" 70 using namespace bogaudio::dsp; 71 72 int main() { 73 printf("%f\n", frequencyToSemitone(1.0f)); 74 printf("%f\n", semitoneToFrequency(0.0f)); 75 printf("%f\n", semitoneToFrequency(60.0f)); 76 printf("%f\n", semitoneToFrequency(120.0f)); 77 printf("%f\n", frequencyToSemitone(20000.0f)); 78 return 0; 79 }