diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2016-04-26 01:16:47 -0400 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2016-04-26 01:16:47 -0400 |
| commit | 140b97a1cd226432a8ec647004943698e3d87f0b (patch) | |
| tree | faeb69d21803b8d83b31dd4b8d01b2231054919a /quantum/audio/voices.c | |
| parent | 6274a216f87bad7d6fe9c9a1a4328dbf444fc364 (diff) | |
| download | qmk_firmware-140b97a1cd226432a8ec647004943698e3d87f0b.tar.gz qmk_firmware-140b97a1cd226432a8ec647004943698e3d87f0b.zip | |
adds delayed vibrato
Diffstat (limited to 'quantum/audio/voices.c')
| -rw-r--r-- | quantum/audio/voices.c | 31 |
1 files changed, 31 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) |
