diff options
| -rw-r--r-- | quantum/audio/voices.c | 31 | ||||
| -rw-r--r-- | quantum/audio/voices.h | 2 |
2 files changed, 33 insertions, 0 deletions
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index de9f8ae54..0921bd593 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include "voices.h" | 1 | #include "voices.h" |
| 2 | #include "stdlib.h" | 2 | #include "stdlib.h" |
| 3 | #include "vibrato_lut.h" | ||
| 3 | 4 | ||
| 4 | // these are imported from audio.c | 5 | // these are imported from audio.c |
| 5 | extern uint16_t envelope_index; | 6 | extern uint16_t envelope_index; |
| @@ -99,6 +100,36 @@ float voice_envelope(float frequency) { | |||
| 99 | if ((envelope_index % 8) == 0) | 100 | if ((envelope_index % 8) == 0) |
| 100 | note_timbre = 0; | 101 | note_timbre = 0; |
| 101 | break; | 102 | break; |
| 103 | case delayed_vibrato: | ||
| 104 | polyphony_rate = 0; | ||
| 105 | note_timbre = TIMBRE_50; | ||
| 106 | #define VOICE_VIBRATO_DELAY 150 | ||
| 107 | #define VOICE_VIBRATO_SPEED 50 | ||
| 108 | switch (compensated_index) { | ||
| 109 | case 0 ... VOICE_VIBRATO_DELAY: | ||
| 110 | break; | ||
| 111 | default: | ||
| 112 | frequency = frequency * VIBRATO_LUT[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1))/1000*VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)]; | ||
| 113 | break; | ||
| 114 | } | ||
| 115 | break; | ||
| 116 | // case delayed_vibrato_octave: | ||
| 117 | // polyphony_rate = 0; | ||
| 118 | // if ((envelope_index % 2) == 1) { | ||
| 119 | // note_timbre = 0.55; | ||
| 120 | // } else { | ||
| 121 | // note_timbre = 0.45; | ||
| 122 | // } | ||
| 123 | // #define VOICE_VIBRATO_DELAY 150 | ||
| 124 | // #define VOICE_VIBRATO_SPEED 50 | ||
| 125 | // switch (compensated_index) { | ||
| 126 | // case 0 ... VOICE_VIBRATO_DELAY: | ||
| 127 | // break; | ||
| 128 | // default: | ||
| 129 | // frequency = frequency * VIBRATO_LUT[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1))/1000*VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)]; | ||
| 130 | // break; | ||
| 131 | // } | ||
| 132 | // break; | ||
| 102 | // case duty_fifth_down: | 133 | // case duty_fifth_down: |
| 103 | // note_timbre = 0.5; | 134 | // note_timbre = 0.5; |
| 104 | // if ((envelope_index % 3) == 0) | 135 | // if ((envelope_index % 3) == 0) |
diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h index 4b894f28d..74c873f42 100644 --- a/quantum/audio/voices.h +++ b/quantum/audio/voices.h | |||
| @@ -16,6 +16,8 @@ typedef enum { | |||
| 16 | octave_crunch, | 16 | octave_crunch, |
| 17 | duty_osc, | 17 | duty_osc, |
| 18 | duty_octave_down, | 18 | duty_octave_down, |
| 19 | delayed_vibrato, | ||
| 20 | // delayed_vibrato_octave, | ||
| 19 | // duty_fifth_down, | 21 | // duty_fifth_down, |
| 20 | // duty_fourth_down, | 22 | // duty_fourth_down, |
| 21 | // duty_third_down, | 23 | // duty_third_down, |
