Commit 3aefd53a authored by Jacob Vosmaer's avatar Jacob Vosmaer

Simplify vibrato rate calculation

parent 93221c1a
......@@ -24,11 +24,6 @@ vibrato_set_depth(uint8_t val)
depth = val;
}
void
vibrato_init(void)
{
}
int16_t
vibrato_detune(void)
{
......
......@@ -4,7 +4,6 @@
#include <stdint.h>
int16_t vibrato_detune(void);
void vibrato_init(void);
void vibrato_update(uint8_t delta);
void vibrato_set_rate(uint8_t val);
void vibrato_set_depth(uint8_t val);
......
......@@ -17,10 +17,11 @@ main(int argc, char **argv)
printf("\n");
printf("float vibrato_rate_table[NUM_CC] = {\n");
float factor = pow(2, ((float)LFO_RANGE) / (NUM_CC - 1));
float val = PHASE_MIN_INCR;
for (int i = 0; i < NUM_CC; i++) {
float val = (float)PHASE_MIN_INCR *
pow(2, ((float)i * LFO_RANGE) / (NUM_CC - 1));
printf("%f,\n", val);
val *= factor;
}
printf("};\n");
......
......@@ -7,34 +7,34 @@
float vibrato_rate_table[NUM_CC] = {
20000.000000, 20892.601562, 21825.039062, 22799.091797,
23816.617188, 24879.554688, 25989.929688, 27149.861328,
28361.562500, 29627.341797, 30949.611328, 32330.894531,
33773.824219, 35281.152344, 36855.750000, 38500.625000,
40218.910156, 42013.882812, 43888.968750, 45847.734375,
47893.917969, 50031.425781, 52264.335938, 54596.894531,
57033.558594, 59578.968750, 62237.984375, 65015.667969,
67917.320312, 70948.468750, 74114.914062, 77422.664062,
80878.039062, 84487.632812, 88258.312500, 92197.289062,
96312.070312, 100610.484375, 105100.734375, 109791.382812,
114691.375000, 119810.054688, 125157.187500, 130742.953125,
136578.046875, 142673.531250, 149041.046875, 155692.765625,
162641.328125, 169900.015625, 177482.671875, 185403.718750,
193678.328125, 202322.203125, 211351.859375, 220784.500000,
230638.109375, 240931.500000, 251684.281250, 262916.968750,
274651.000000, 286908.687500, 299713.437500, 313089.656250,
327062.875000, 341659.687500, 356907.968750, 372836.781250,
389476.500000, 406858.875000, 425017.000000, 443985.531250,
463800.750000, 484500.218750, 506123.468750, 528711.812500,
552308.187500, 576957.750000, 602707.375000, 629606.250000,
657705.625000, 687059.062500, 717722.500000, 749754.500000,
783216.062500, 818171.000000, 854686.000000, 892830.687500,
932678.062500, 974303.562500, 1017786.750000, 1063210.625000,
1110661.750000, 1160230.625000, 1212011.750000, 1266103.875000,
1322610.125000, 1381638.250000, 1443300.875000, 1507715.500000,
1575004.875000, 1645297.375000, 1718727.000000, 1795433.875000,
1875564.875000, 1959271.375000, 2046713.750000, 2138058.750000,
2233480.250000, 2333160.500000, 2437289.750000, 2546066.000000,
2659697.000000, 2778399.250000, 2902399.500000, 3031933.750000,
3167249.000000, 3308603.500000, 3456266.500000, 3610519.750000,
3771658.750000, 3939988.000000, 4115829.750000, 4299519.500000,
4491407.000000, 4691859.000000, 4901256.500000, 5120000.000000,
28361.560547, 29627.337891, 30949.607422, 32330.890625,
33773.820312, 35281.148438, 36855.746094, 38500.621094,
40218.906250, 42013.878906, 43888.960938, 45847.726562,
47893.914062, 50031.421875, 52264.328125, 54596.886719,
57033.546875, 59578.957031, 62237.968750, 65015.652344,
67917.304688, 70948.460938, 74114.890625, 77422.640625,
80878.015625, 84487.609375, 88258.296875, 92197.265625,
96312.031250, 100610.445312, 105100.695312, 109791.343750,
114691.335938, 119810.015625, 125157.140625, 130742.906250,
136577.968750, 142673.453125, 149040.984375, 155692.687500,
162641.265625, 169899.953125, 177482.593750, 185403.656250,
193678.234375, 202322.109375, 211351.750000, 220784.390625,
230638.015625, 240931.406250, 251684.187500, 262916.875000,
274650.875000, 286908.562500, 299713.312500, 313089.531250,
327062.718750, 341659.531250, 356907.812500, 372836.625000,
389476.343750, 406858.687500, 425016.812500, 443985.343750,
463800.437500, 484499.875000, 506123.125000, 528711.437500,
552307.875000, 576957.375000, 602707.000000, 629605.875000,
657705.187500, 687058.625000, 717722.062500, 749754.062500,
783215.625000, 818170.562500, 854685.562500, 892830.250000,
932677.312500, 974302.750000, 1017785.937500, 1063209.750000,
1110660.875000, 1160229.750000, 1212010.875000, 1266103.000000,
1322609.250000, 1381637.375000, 1443299.875000, 1507714.375000,
1575003.750000, 1645296.250000, 1718725.875000, 1795432.750000,
1875563.000000, 1959269.500000, 2046711.750000, 2138056.500000,
2233478.000000, 2333158.250000, 2437287.250000, 2546063.500000,
2659694.500000, 2778396.750000, 2902396.750000, 3031930.750000,
3167246.000000, 3308600.250000, 3456263.250000, 3610516.500000,
3771654.000000, 3939983.000000, 4115824.750000, 4299514.000000,
4491401.500000, 4691853.000000, 4901250.500000, 5119993.500000,
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment