diff options
author | Jack Humbert <jack.humb@gmail.com> | 2016-12-20 19:38:22 -0500 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2016-12-20 19:38:22 -0500 |
commit | 438a5d685bb7b726ff59109ce4229eca6303cd8e (patch) | |
tree | 3e3feecf370efe3dfd373bafa3db7ea347fa3449 /quantum/audio/voices.c | |
parent | 53ea854462c0b3b2c3c58a36b714ac02f773c74f (diff) |
limit voices by default, add some drums
Diffstat (limited to 'quantum/audio/voices.c')
-rw-r--r-- | quantum/audio/voices.c | 105 |
1 files changed, 80 insertions, 25 deletions
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 06ff275ba4..4e30289775 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -33,6 +33,8 @@ float voice_envelope(float frequency) { polyphony_rate = 0; break; + #ifdef AUDIO_VOICES + case something: glissando = false; polyphony_rate = 0; @@ -58,36 +60,87 @@ float voice_envelope(float frequency) { case drums: glissando = false; polyphony_rate = 0; - note_timbre = 0; + // switch (compensated_index) { + // case 0 ... 10: + // note_timbre = 0.5; + // break; + // case 11 ... 20: + // note_timbre = 0.5 * (21 - compensated_index) / 10; + // break; + // default: + // note_timbre = 0; + // break; + // } + // frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8); + + if (frequency < 80.0) { + + } else if (frequency < 160.0) { + + // Bass drum: 60 - 100 Hz + frequency = (rand() % (int)(40)) + 60; + switch (envelope_index) { + case 0 ... 10: + note_timbre = 0.5; + break; + case 11 ... 20: + note_timbre = 0.5 * (21 - envelope_index) / 10; + break; + default: + note_timbre = 0; + break; + } + + } else if (frequency < 320.0) { + + + // Snare drum: 1 - 2 KHz + frequency = (rand() % (int)(1000)) + 1000; + switch (envelope_index) { + case 0 ... 5: + note_timbre = 0.5; + break; + case 6 ... 20: + note_timbre = 0.5 * (21 - envelope_index) / 15; + break; + default: + note_timbre = 0; + break; + } + + } else if (frequency < 640.0) { + + // Closed Hi-hat: 3 - 5 KHz + frequency = (rand() % (int)(2000)) + 3000; switch (envelope_index) { - case 0 ... 20: + case 0 ... 15: note_timbre = 0.5; + break; + case 16 ... 20: + note_timbre = 0.5 * (21 - envelope_index) / 5; + break; default: - frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8); + note_timbre = 0; break; } - // if (frequency < 80.0) { - // switch (envelope_index % 4) { - // case 0: - // frequency = 348.0; - // case 1: - // frequency = 53.0; - // case 2: - // frequency = 128.0; - // case 3: - // frequency = 934.0; - // default: - // break; - // } - // } else if (frequency < 160.0) { - - // } else if (frequency < 320.0) { - - // } else if (frequency < 640.0) { - - // } else if (frequency < 1280.0) { - - // } + + } else if (frequency < 1280.0) { + + // Open Hi-hat: 3 - 5 KHz + frequency = (rand() % (int)(2000)) + 3000; + switch (envelope_index) { + case 0 ... 35: + note_timbre = 0.5; + break; + case 36 ... 50: + note_timbre = 0.5 * (51 - envelope_index) / 15; + break; + default: + note_timbre = 0; + break; + } + + } break; case butts_fader: glissando = true; @@ -217,6 +270,8 @@ float voice_envelope(float frequency) { // note_timbre = 0.25; // break; + #endif + default: break; } |