]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
adds delayed vibrato
authorJack Humbert <jack.humb@gmail.com>
Tue, 26 Apr 2016 05:16:47 +0000 (01:16 -0400)
committerJack Humbert <jack.humb@gmail.com>
Tue, 26 Apr 2016 05:16:47 +0000 (01:16 -0400)
quantum/audio/voices.c
quantum/audio/voices.h

index de9f8ae544cb549e8fd6de328280c81ee3a6056a..0921bd5931eda1e7a98bb9711d8cafb3efc022fa 100644 (file)
@@ -1,5 +1,6 @@
 #include "voices.h"
 #include "stdlib.h"
+#include "vibrato_lut.h"
 
 // these are imported from audio.c
 extern uint16_t envelope_index;
@@ -99,6 +100,36 @@ float voice_envelope(float frequency) {
             if ((envelope_index % 8) == 0)
                 note_timbre = 0;
             break;
+        case delayed_vibrato:
+            polyphony_rate = 0;
+            note_timbre = TIMBRE_50;
+            #define VOICE_VIBRATO_DELAY 150
+            #define VOICE_VIBRATO_SPEED 50
+            switch (compensated_index) {
+                case 0 ... VOICE_VIBRATO_DELAY:
+                    break;
+                default:
+                    frequency = frequency * VIBRATO_LUT[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1))/1000*VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)];
+                    break;
+            }
+            break;
+        // case delayed_vibrato_octave:
+        //     polyphony_rate = 0;
+        //     if ((envelope_index % 2) == 1) {
+        //         note_timbre = 0.55;
+        //     } else {
+        //         note_timbre = 0.45;
+        //     }
+        //     #define VOICE_VIBRATO_DELAY 150
+        //     #define VOICE_VIBRATO_SPEED 50
+        //     switch (compensated_index) {
+        //         case 0 ... VOICE_VIBRATO_DELAY:
+        //             break;
+        //         default:
+        //             frequency = frequency * VIBRATO_LUT[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1))/1000*VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)];
+        //             break;
+        //     }
+        //     break;
         // case duty_fifth_down:
         //     note_timbre = 0.5;
         //     if ((envelope_index % 3) == 0)
index 4b894f28d4800a1de9ea39438e54fa6aec6e0eec..74c873f42f042f9ed3982734cd75db8135422f20 100644 (file)
@@ -16,6 +16,8 @@ typedef enum {
     octave_crunch,
     duty_osc,
     duty_octave_down,
+    delayed_vibrato,
+    // delayed_vibrato_octave,
     // duty_fifth_down,
     // duty_fourth_down,
     // duty_third_down,