You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

521 lines
5.5 KiB

static const int16_t sine_table_256[256] = {
0,
402,
804,
1205,
1606,
2005,
2404,
2801,
3196,
3590,
3981,
4370,
4756,
5139,
5519,
5896,
6270,
6639,
7005,
7366,
7723,
8075,
8423,
8765,
9102,
9433,
9759,
10079,
10393,
10701,
11002,
11297,
11585,
11865,
12139,
12405,
12664,
12915,
13159,
13394,
13622,
13841,
14052,
14255,
14449,
14634,
14810,
14977,
15136,
15285,
15425,
15556,
15678,
15790,
15892,
15985,
16068,
16142,
16206,
16260,
16304,
16339,
16363,
16378,
16383,
16378,
16363,
16339,
16304,
16260,
16206,
16142,
16068,
15985,
15892,
15790,
15678,
15556,
15425,
15285,
15136,
14977,
14810,
14634,
14449,
14255,
14052,
13841,
13622,
13394,
13159,
12915,
12664,
12405,
12139,
11865,
11585,
11297,
11002,
10701,
10393,
10079,
9759,
9433,
9102,
8765,
8423,
8075,
7723,
7366,
7005,
6639,
6270,
5896,
5519,
5139,
4756,
4370,
3981,
3590,
3196,
2801,
2404,
2005,
1606,
1205,
804,
402,
0,
-402,
-804,
-1205,
-1606,
-2005,
-2404,
-2801,
-3196,
-3590,
-3981,
-4370,
-4756,
-5139,
-5519,
-5896,
-6270,
-6639,
-7005,
-7366,
-7723,
-8075,
-8423,
-8765,
-9102,
-9433,
-9759,
-10079,
-10393,
-10701,
-11002,
-11297,
-11585,
-11865,
-12139,
-12405,
-12664,
-12915,
-13159,
-13394,
-13622,
-13841,
-14052,
-14255,
-14449,
-14634,
-14810,
-14977,
-15136,
-15285,
-15425,
-15556,
-15678,
-15790,
-15892,
-15985,
-16068,
-16142,
-16206,
-16260,
-16304,
-16339,
-16363,
-16378,
-16383,
-16378,
-16363,
-16339,
-16304,
-16260,
-16206,
-16142,
-16068,
-15985,
-15892,
-15790,
-15678,
-15556,
-15425,
-15285,
-15136,
-14977,
-14810,
-14634,
-14449,
-14255,
-14052,
-13841,
-13622,
-13394,
-13159,
-12915,
-12664,
-12405,
-12139,
-11865,
-11585,
-11297,
-11002,
-10701,
-10393,
-10079,
-9759,
-9433,
-9102,
-8765,
-8423,
-8075,
-7723,
-7366,
-7005,
-6639,
-6270,
-5896,
-5519,
-5139,
-4756,
-4370,
-3981,
-3590,
-3196,
-2801,
-2404,
-2005,
-1606,
-1205,
-804,
};
// http://www.richardbrice.net/midi_notes.htm
static const float midi_note_freq_table[128] = {
8.1757989156,
8.661957218,
9.1770239974,
9.7227182413,
10.3008611535,
10.9133822323,
11.5623257097,
12.2498573744,
12.9782717994,
13.75,
14.5676175474,
15.4338531643,
16.3515978313,
17.3239144361,
18.3540479948,
19.4454364826,
20.6017223071,
21.8267644646,
23.1246514195,
24.4997147489,
25.9565435987,
27.5,
29.1352350949,
30.8677063285,
32.7031956626,
34.6478288721,
36.7080959897,
38.8908729653,
41.2034446141,
43.6535289291,
46.249302839,
48.9994294977,
51.9130871975,
55,
58.2704701898,
61.735412657,
65.4063913251,
69.2956577442,
73.4161919794,
77.7817459305,
82.4068892282,
87.3070578583,
92.4986056779,
97.9988589954,
103.826174395,
110,
116.5409403795,
123.470825314,
130.8127826503,
138.5913154884,
146.8323839587,
155.563491861,
164.8137784564,
174.6141157165,
184.9972113558,
195.9977179909,
207.65234879,
220,
233.081880759,
246.9416506281,
261.6255653006,
277.1826309769,
293.6647679174,
311.1269837221,
329.6275569129,
349.228231433,
369.9944227116,
391.9954359818,
415.3046975799,
440,
466.1637615181,
493.8833012561,
523.2511306012,
554.3652619537,
587.3295358348,
622.2539674442,
659.2551138257,
698.456462866,
739.9888454233,
783.9908719635,
830.6093951599,
880,
932.3275230362,
987.7666025122,
1046.5022612024,
1108.7305239075,
1174.6590716696,
1244.5079348883,
1318.5102276515,
1396.912925732,
1479.9776908465,
1567.981743927,
1661.2187903198,
1760,
1864.6550460724,
1975.5332050245,
2093.0045224048,
2217.461047815,
2349.3181433393,
2489.0158697767,
2637.020455303,
2793.825851464,
2959.9553816931,
3135.963487854,
3322.4375806396,
3520,
3729.3100921447,
3951.066410049,
4186.0090448096,
4434.92209563,
4698.6362866785,
4978.0317395533,
5274.0409106059,
5587.6517029281,
5919.9107633862,
6271.926975708,
6644.8751612791,
7040,
7458.6201842894,
7902.132820098,
8372.0180896192,
8869.8441912599,
9397.2725733571,
9956.0634791066,
10548.0818212118,
11175.3034058561,
11839.8215267723,
12543.853951416,
};
static const uint32_t midi_note_freq_fixed[128] = {
535809,
567670,
601425,
637188,
675077,
715219,
757749,
802807,
850544,
901120,
954703,
1011473,
1071618,
1135340,
1202851,
1274376,
1350154,
1430439,
1515497,
1605613,
1701088,
1802240,
1909407,
2022946,
2143237,
2270680,
2405702,
2548752,
2700309,
2860878,
3030994,
3211227,
3402176,
3604480,
3818814,
4045892,
4286473,
4541360,
4811404,
5097505,
5400618,
5721755,
6061989,
6422453,
6804352,
7208960,
7637627,
8091784,
8572947,
9082720,
9622807,
10195009,
10801236,
11443511,
12123977,
12844906,
13608704,
14417920,
15275254,
16183568,
17145893,
18165441,
19245614,
20390018,
21602472,
22887021,
24247954,
25689813,
27217409,
28835840,
30550508,
32367136,
34291786,
36330882,
38491228,
40780036,
43204943,
45774043,
48495909,
51379626,
54434817,
57671680,
61101017,
64734272,
68583572,
72661764,
76982457,
81560072,
86409886,
91548086,
96991818,
102759252,
108869635,
115343360,
122202033,
129468544,
137167144,
145323527,
153964914,
163120144,
172819773,
183096171,
193983636,
205518503,
217739269,
230686720,
244404066,
258937088,
274334289,
290647054,
307929828,
326240288,
345639545,
366192342,
387967272,
411037006,
435478539,
461373440,
488808132,
517874176,
548668578,
581294109,
615859655,
652480576,
691279090,
732384684,
775934544,
822074013,
};