diff options
Diffstat (limited to 'src/notes.h')
-rw-r--r-- | src/notes.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/notes.h b/src/notes.h new file mode 100644 index 0000000..ed6b3e6 --- /dev/null +++ b/src/notes.h @@ -0,0 +1,51 @@ +#ifndef NOTES_H +#define NOTES_H + +static float note_C[] = {16.35, 32.70, 65.41, 130.81, 261.63, 523.25, 1046.50, 2093.00, 4186.01}; +static float note_Db[] = {17.32, 34.65, 69.30, 138.59, 277.18, 554.37, 1108.73, 2217.46, 4434.92}; +static float note_D[] = {18.35, 36.71, 73.42, 146.83, 293.66, 587.33, 1174.66, 2349.32, 4698.64}; +static float note_Eb[] = {19.45, 38.89, 77.78, 155.56, 311.13, 622.25, 1244.51, 2489.02, 4978.03}; +static float note_E[] = {20.60, 41.20, 82.41, 164.81, 329.63, 659.26, 1318.51, 2637.02}; +static float note_F[] = {21.83, 43.65, 87.31, 174.61, 349.23, 698.46, 1396.91, 2793.83}; +static float note_Gb[] = {23.12, 46.25, 92.50, 185.00, 369.99, 739.99, 1479.98, 2959.96}; +static float note_G[] = {24.50, 49.00, 98.00, 196.00, 392.00, 783.99, 1567.98, 3135.96}; +static float note_Ab[] = {25.96, 51.91, 103.83, 207.65, 415.30, 830.61, 1661.22, 3322.44}; +static float note_A[] = {27.50, 55.00, 110.00, 220.00, 440.00, 880.00, 1760.00, 3520.00}; +static float note_Bb[] = {29.14, 58.27, 116.54, 233.08, 466.16, 932.33, 1864.66, 3729.31}; +static float note_B[] = {30.87, 61.74, 123.47, 246.94, 493.88, 987.77, 1975.53, 3951.0}; + +static float *notes[12] = {note_C, note_Db, note_D, note_Eb, note_E, note_F, note_Gb, note_G, note_Ab, note_A, note_Bb, note_B }; + +static char * +int_to_note(int n) +{ + switch (n) { + case 0: + return "C"; + case 1: + return "Db"; + case 2: + return "D"; + case 3: + return "Eb"; + case 4: + return "E"; + case 5: + return "F"; + case 6: + return "Gb"; + case 7: + return "G"; + case 8: + return "Ab"; + case 9: + return "A"; + case 10: + return "Bb"; + case 11: + return "B"; + } + return ""; +} + +#endif /* NOTES_H */ |