From 140b97a1cd226432a8ec647004943698e3d87f0b Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 26 Apr 2016 01:16:47 -0400 Subject: adds delayed vibrato --- quantum/audio/voices.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'quantum/audio/voices.c') 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 @@ #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) -- cgit v1.2.3-24-g4f1b From 66e0323881a5a3da65e14daeec41a1e9cfbda431 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 29 Apr 2016 12:42:55 -0400 Subject: removes extra voices, updates .hex files --- quantum/audio/voices.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'quantum/audio/voices.c') diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index 0921bd593..d2316ba1b 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -54,28 +54,28 @@ float voice_envelope(float frequency) { } break; - case octave_crunch: - polyphony_rate = 0; - switch (compensated_index) { - case 0 ... 9: - case 20 ... 24: - case 30 ... 32: - frequency = frequency / 2; - note_timbre = TIMBRE_12; - break; - - case 10 ... 19: - case 25 ... 29: - case 33 ... 35: - frequency = frequency * 2; - note_timbre = TIMBRE_12; - break; + // case octave_crunch: + // polyphony_rate = 0; + // switch (compensated_index) { + // case 0 ... 9: + // case 20 ... 24: + // case 30 ... 32: + // frequency = frequency / 2; + // note_timbre = TIMBRE_12; + // break; + + // case 10 ... 19: + // case 25 ... 29: + // case 33 ... 35: + // frequency = frequency * 2; + // note_timbre = TIMBRE_12; + // break; - default: - note_timbre = TIMBRE_12; - break; - } - break; + // default: + // note_timbre = TIMBRE_12; + // break; + // } + // break; case duty_osc: // This slows the loop down a substantial amount, so higher notes may freeze -- cgit v1.2.3-24-g4f1b From 83e1cc241e3aabd69f6cdcd2581477d4b85bb8d3 Mon Sep 17 00:00:00 2001 From: IBNobody Date: Tue, 3 May 2016 12:56:40 -0500 Subject: Clarified audio.c (#302) * Updated personal layouts * tweaked personal * Nightly - Audio Cleanup Refactored the LUTs. Abstracted some of the registers out of audio to use more functional names. Split audio into audio and audio_pwm. WIP * nightly - collapsed code * Added check for note playing to LEDs --- quantum/audio/voices.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'quantum/audio/voices.c') diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c index d2316ba1b..6d4172a06 100644 --- a/quantum/audio/voices.c +++ b/quantum/audio/voices.c @@ -1,6 +1,6 @@ #include "voices.h" +#include "audio.h" #include "stdlib.h" -#include "vibrato_lut.h" // these are imported from audio.c extern uint16_t envelope_index; @@ -109,7 +109,7 @@ float voice_envelope(float frequency) { 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)]; + frequency = frequency * vibrato_lut[(int)fmod((((float)compensated_index - (VOICE_VIBRATO_DELAY + 1))/1000*VOICE_VIBRATO_SPEED), VIBRATO_LUT_LENGTH)]; break; } break; @@ -160,4 +160,6 @@ float voice_envelope(float frequency) { } return frequency; -} \ No newline at end of file +} + + -- cgit v1.2.3-24-g4f1b