|
|
|
@ -166,8 +166,8 @@ elapsedMillis debug_audio_timer; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
|
short l_delayline[CHORUS_DELAY_LENGTH_SAMPLES]; |
|
|
|
|
short r_delayline[CHORUS_DELAY_LENGTH_SAMPLES]; |
|
|
|
|
short l_delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
short r_delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
|
|
|
|
|
enum { VOL_MAIN, VOL_REVERB, VOL_CHORUS }; |
|
|
|
|
//*************************************************************************************************
|
|
|
|
@ -232,22 +232,33 @@ void setup() |
|
|
|
|
Serial.print(audio_block_time_us); |
|
|
|
|
Serial.println(F("us)")); |
|
|
|
|
|
|
|
|
|
if (!modchorus_r.begin(r_delayline, CHORUS_DELAY_LENGTH_SAMPLES)) { |
|
|
|
|
if (!modchorus_r.begin(r_delayline, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
|
Serial.println(F("AudioEffectModulatedDelay - right channel begin failed")); |
|
|
|
|
while (1); |
|
|
|
|
} |
|
|
|
|
if (!modchorus_l.begin(l_delayline, CHORUS_DELAY_LENGTH_SAMPLES)) { |
|
|
|
|
if (!modchorus_l.begin(l_delayline, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
|
Serial.println(F("AudioEffectModulatedDelay - left channel begin failed")); |
|
|
|
|
while (1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// chorus modulation fixed
|
|
|
|
|
modulator.begin(WAVEFORM_MOD); |
|
|
|
|
modulator.begin(MOD_WAVEFORM); |
|
|
|
|
modulator.phase(0); |
|
|
|
|
modulator.amplitude(0.0); |
|
|
|
|
modulator.offset(0.0); |
|
|
|
|
modchorus_r.offset(0); |
|
|
|
|
modchorus_l.offset(0); |
|
|
|
|
#ifdef DEBUG |
|
|
|
|
Serial.print(F("Modulated delay buffer: ")); |
|
|
|
|
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC); |
|
|
|
|
Serial.println(F(" samples")); |
|
|
|
|
Serial.print(F("Default delay time: ")); |
|
|
|
|
Serial.print(float(ENC_CHORUS_DELAY_DEFAULT) / 10, 2); |
|
|
|
|
Serial.println(" ms"); |
|
|
|
|
Serial.print(F("Max delay time: ")); |
|
|
|
|
Serial.print(float(ENC_CHORUS_DELAY_MAX) / 10, 2); |
|
|
|
|
Serial.println(F(" ms")); |
|
|
|
|
#endif |
|
|
|
|
modchorus_r.offset(TIME_MS2SAMPLES(float(ENC_CHORUS_DELAY_DEFAULT) / 10)); |
|
|
|
|
modchorus_l.offset(TIME_MS2SAMPLES(float(ENC_CHORUS_DELAY_DEFAULT) / 10)); |
|
|
|
|
// Butterworth filter, 12 db/octave
|
|
|
|
|
modchorus_filter_r.setLowpass(0, 6000, 0.707); |
|
|
|
|
modchorus_filter_l.setLowpass(0, 6000, 0.707); |
|
|
|
|