summaryrefslogtreecommitdiffstats
path: root/quantum/audio/voices.c
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-04-22 05:10:47 +0200
committerJack Humbert <jack.humb@gmail.com>2016-04-22 05:10:49 +0200
commit7b3f212500210ae85063b043952b5b3ef6988ad6 (patch)
tree5a4f38677e7e4c5babc03272562a89e5138af77f /quantum/audio/voices.c
parentfa40e91b5649e4a7aa833f3ae203169386c02721 (diff)
downloadqmk_firmware-7b3f212500210ae85063b043952b5b3ef6988ad6.tar.gz
qmk_firmware-7b3f212500210ae85063b043952b5b3ef6988ad6.tar.xz
adds more voices, fixes macro redefines
Diffstat (limited to 'quantum/audio/voices.c')
-rw-r--r--quantum/audio/voices.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c
index 92ada47f7..98631f0cb 100644
--- a/quantum/audio/voices.c
+++ b/quantum/audio/voices.c
@@ -72,15 +72,19 @@ float voice_envelope(float frequency) {
polyphony_rate = 0;
switch (compensated_index) {
default:
- #define SPEED 10
- #define AMP .75
+ #define OCS_SPEED 10
+ #define OCS_AMP .25
// sine wave is slow
- // note_timbre = (sin((float)compensated_index/10000*SPEED) * AMP / 2) + .5;
+ // note_timbre = (sin((float)compensated_index/10000*OCS_SPEED) * OCS_AMP / 2) + .5;
// triangle wave is a bit faster
- note_timbre = (float)abs((compensated_index*SPEED % 3000) - 1500) * ( AMP / 1500 ) + (1 - AMP) / 2;
+ note_timbre = (float)abs((compensated_index*OCS_SPEED % 3000) - 1500) * ( OCS_AMP / 1500 ) + (1 - OCS_AMP) / 2;
break;
}
break;
+ case duty_octave_down:
+ polyphony_rate = 0;
+ note_timbre = (envelope_index % 2) * .125 + .375 * 2;
+ break;
}
return frequency;