From 0edfe55bfe4afd037918ff73e49552a28f39a5ca Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 12 Dec 2016 15:39:07 -0500 Subject: re-enable audio and extrakeys --- quantum/audio/voices.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'quantum/audio/voices.c') diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 6d4172a06c..19f7b646ef 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -18,7 +18,7 @@ void voice_iterate() { } void voice_deiterate() { - voice = (voice - 1) % number_of_voices; + voice = (voice - 1 + number_of_voices) % number_of_voices; } float voice_envelope(float frequency) { @@ -31,6 +31,27 @@ float voice_envelope(float frequency) { polyphony_rate = 0; break; + case something: + polyphony_rate = 0; + switch (compensated_index) { + case 0 ... 9: + note_timbre = TIMBRE_12; + break; + + case 10 ... 19: + note_timbre = TIMBRE_25; + break; + + case 20 ... 200: + note_timbre = .25 + .125 + pow(((float)compensated_index - 20) / (200 - 20), 2)*.125; + break; + + default: + note_timbre = .25; + break; + } + break; + case butts_fader: polyphony_rate = 0; switch (compensated_index) { -- cgit v1.2.3 From 06c64bbff3e228df542149acde64eadaf59b9b0f Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 19 Dec 2016 11:18:18 -0500 Subject: rgb clean-up, api clean-up --- quantum/audio/voices.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'quantum/audio/voices.c') diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 19f7b646ef..06ff275ba4 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -6,6 +6,7 @@ extern uint16_t envelope_index; extern float note_timbre; extern float polyphony_rate; +extern bool glissando; voice_type voice = default_voice; @@ -27,11 +28,13 @@ float voice_envelope(float frequency) { switch (voice) { case default_voice: + glissando = true; note_timbre = TIMBRE_50; polyphony_rate = 0; break; case something: + glissando = false; polyphony_rate = 0; switch (compensated_index) { case 0 ... 9: @@ -43,16 +46,51 @@ float voice_envelope(float frequency) { break; case 20 ... 200: - note_timbre = .25 + .125 + pow(((float)compensated_index - 20) / (200 - 20), 2)*.125; + note_timbre = .125 + .125; break; default: - note_timbre = .25; + note_timbre = .125; break; } break; + case drums: + glissando = false; + polyphony_rate = 0; + note_timbre = 0; + switch (envelope_index) { + case 0 ... 20: + note_timbre = 0.5; + default: + frequency = (rand() % (int)(frequency * 1.2 - frequency)) + (frequency * 0.8); + 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) { + + // } + break; case butts_fader: + glissando = true; polyphony_rate = 0; switch (compensated_index) { case 0 ... 9: @@ -100,6 +138,7 @@ float voice_envelope(float frequency) { case duty_osc: // This slows the loop down a substantial amount, so higher notes may freeze + glissando = true; polyphony_rate = 0; switch (compensated_index) { default: @@ -114,6 +153,7 @@ float voice_envelope(float frequency) { break; case duty_octave_down: + glissando = true; polyphony_rate = 0; note_timbre = (envelope_index % 2) * .125 + .375 * 2; if ((envelope_index % 4) == 0) @@ -122,6 +162,7 @@ float voice_envelope(float frequency) { note_timbre = 0; break; case delayed_vibrato: + glissando = true; polyphony_rate = 0; note_timbre = TIMBRE_50; #define VOICE_VIBRATO_DELAY 150 -- cgit v1.2.3 From 438a5d685bb7b726ff59109ce4229eca6303cd8e Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 20 Dec 2016 19:38:22 -0500 Subject: limit voices by default, add some drums --- quantum/audio/voices.c | 105 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 25 deletions(-) (limited to 'quantum/audio/voices.c') 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; } -- cgit v1.2.3 From 2fa36e38cf28f07ad4a4d74722486921fa7b8706 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 21 Dec 2016 00:22:32 -0500 Subject: initial subatomic keymap (text) --- quantum/audio/voices.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'quantum/audio/voices.c') diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 4e30289775..8326e91eaa 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -278,5 +278,3 @@ float voice_envelope(float frequency) { return frequency; } - - -- cgit v1.2.3