|
|
@ -40,23 +40,18 @@ |
|
|
|
|
|
|
|
|
|
|
|
AudioPlayQueue dexed1; |
|
|
|
AudioPlayQueue dexed1; |
|
|
|
AudioAnalyzePeak peak1; |
|
|
|
AudioAnalyzePeak peak1; |
|
|
|
AudioEffectDelay delay_r; |
|
|
|
AudioEffectDelay delay1; |
|
|
|
AudioEffectDelay delay_l; |
|
|
|
#ifdef USE_REVERB |
|
|
|
AudioEffectFreeverbStereo freeverbs1; |
|
|
|
AudioEffectFreeverbStereo freeverbs1; |
|
|
|
AudioEffectModulatedDelay modchorus_r; |
|
|
|
#endif |
|
|
|
AudioEffectModulatedDelay modchorus_l; |
|
|
|
AudioEffectModulatedDelay modchorus; |
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
AudioFilterBiquad modchorus_filter_r; |
|
|
|
AudioFilterBiquad modchorus_filter; |
|
|
|
AudioFilterBiquad modchorus_filter_l; |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
AudioSynthWaveform modulator; |
|
|
|
AudioSynthWaveform modulator; |
|
|
|
AudioAmplifier inverter; |
|
|
|
AudioMixer4 chorus_mixer; |
|
|
|
AudioMixer4 chorus_mixer_r; |
|
|
|
AudioMixer4 delay_mixer; |
|
|
|
AudioMixer4 chorus_mixer_l; |
|
|
|
AudioMixer4 delay_fb_mixer; |
|
|
|
AudioMixer4 delay_mixer_r; |
|
|
|
|
|
|
|
AudioMixer4 delay_mixer_l; |
|
|
|
|
|
|
|
AudioMixer4 delay_fb_mixer_r; |
|
|
|
|
|
|
|
AudioMixer4 delay_fb_mixer_l; |
|
|
|
|
|
|
|
AudioMixer4 reverb_mixer_r; |
|
|
|
AudioMixer4 reverb_mixer_r; |
|
|
|
AudioMixer4 reverb_mixer_l; |
|
|
|
AudioMixer4 reverb_mixer_l; |
|
|
|
AudioAmplifier volume_r; |
|
|
|
AudioAmplifier volume_r; |
|
|
@ -65,62 +60,56 @@ AudioAmplifier volume_l; |
|
|
|
AudioOutputUSB usb1; |
|
|
|
AudioOutputUSB usb1; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
AudioConnection patchCord0(dexed1, peak1); |
|
|
|
AudioConnection patchCord0(dexed1, peak1); |
|
|
|
AudioConnection patchCord1(dexed1, 0, chorus_mixer_r, 0); |
|
|
|
AudioConnection patchCord1(dexed1, 0, chorus_mixer, 0); |
|
|
|
AudioConnection patchCord2(dexed1, 0, chorus_mixer_l, 0); |
|
|
|
AudioConnection patchCord3(dexed1, 0, delay_mixer, 0); |
|
|
|
AudioConnection patchCord3(dexed1, 0, delay_mixer_r, 0); |
|
|
|
AudioConnection patchCord4(dexed1, 0, delay_fb_mixer, 0); |
|
|
|
AudioConnection patchCord4(dexed1, 0, delay_mixer_l, 0); |
|
|
|
#ifdef USE_REVERB |
|
|
|
AudioConnection patchCord5(dexed1, 0, delay_fb_mixer_r, 0); |
|
|
|
AudioConnection patchCord5(dexed1, 0, reverb_mixer_r, 0); |
|
|
|
AudioConnection patchCord6(dexed1, 0, delay_fb_mixer_l, 0); |
|
|
|
AudioConnection patchCord6(dexed1, 0, reverb_mixer_l, 0); |
|
|
|
AudioConnection patchCord7(dexed1, 0, reverb_mixer_r, 0); |
|
|
|
#endif |
|
|
|
AudioConnection patchCord8(dexed1, 0, reverb_mixer_l, 0); |
|
|
|
AudioConnection patchCord7(dexed1, 0, modchorus, 0); |
|
|
|
AudioConnection patchCord9(dexed1, 0, modchorus_r, 0); |
|
|
|
AudioConnection patchCord8(modulator, 0, modchorus, 1); |
|
|
|
AudioConnection patchCord10(dexed1, 0, modchorus_l, 0); |
|
|
|
|
|
|
|
AudioConnection patchCord11(modulator, 0, modchorus_r, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord12(modulator, inverter); |
|
|
|
|
|
|
|
AudioConnection patchCord13(inverter, 0, modchorus_l, 1); |
|
|
|
|
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT |
|
|
|
AudioConnection patchCord14(modchorus_r, modchorus_filter_r); |
|
|
|
AudioConnection patchCord9(modchorus, modchorus_filter); |
|
|
|
AudioConnection patchCord15(modchorus_l, modchorus_filter_l); |
|
|
|
AudioConnection patchCord10(modchorus_filter, 0, chorus_mixer, 1); |
|
|
|
AudioConnection patchCord16(modchorus_filter_r, 0, chorus_mixer_r, 1); |
|
|
|
#else |
|
|
|
AudioConnection patchCord17(modchorus_filter_l, 0, chorus_mixer_l, 1); |
|
|
|
AudioConnection patchCord9(modchorus, 0, chorus_mixer, 1); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
AudioConnection patchCord11(chorus_mixer, 0, delay_mixer, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord12(delay_fb_mixer, 0, delay_mixer, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord13(delay_mixer, 0, reverb_mixer_r, 0); |
|
|
|
|
|
|
|
AudioConnection patchCord14(delay_mixer, 0, reverb_mixer_l, 0); |
|
|
|
|
|
|
|
AudioConnection patchCord15(delay1, 0, delay_mixer, 2); |
|
|
|
|
|
|
|
AudioConnection patchCord16(delay_fb_mixer, delay1); |
|
|
|
|
|
|
|
#ifdef USE_REVERB |
|
|
|
|
|
|
|
AudioConnection patchCord17(delay_mixer, 0, freeverbs1, 0); |
|
|
|
|
|
|
|
AudioConnection patchCord18(delay_mixer, 0, freeverbs1, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord19(freeverbs1, 0, reverb_mixer_r, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord20(freeverbs1, 1, reverb_mixer_l, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord21(reverb_mixer_r, volume_r); |
|
|
|
|
|
|
|
AudioConnection patchCord22(reverb_mixer_l, volume_l); |
|
|
|
#else |
|
|
|
#else |
|
|
|
AudioConnection patchCord14(modchorus_r, 0, chorus_mixer_r, 1); |
|
|
|
AudioConnection patchCord17(delay_mixer, volume_r); |
|
|
|
AudioConnection patchCord15(modchorus_l, 0, chorus_mixer_l, 1); |
|
|
|
AudioConnection patchCord18(delay_mixer, volume_l); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
AudioConnection patchCord18(chorus_mixer_r, 0, delay_mixer_r, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord19(chorus_mixer_l, 0, delay_mixer_l, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord20(delay_fb_mixer_r, 0, delay_mixer_r, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord21(delay_fb_mixer_l, 0, delay_mixer_l, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord22(delay_mixer_r, 0, reverb_mixer_r, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord23(delay_mixer_l, 0, reverb_mixer_l, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord24(delay_r, 0, delay_mixer_r, 2); |
|
|
|
|
|
|
|
AudioConnection patchCord25(delay_l, 0, delay_mixer_l, 2); |
|
|
|
|
|
|
|
AudioConnection patchCord26(delay_fb_mixer_r, delay_r); |
|
|
|
|
|
|
|
AudioConnection patchCord27(delay_fb_mixer_l, delay_l); |
|
|
|
|
|
|
|
AudioConnection patchCord28(delay_mixer_r, 0, freeverbs1, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord29(delay_mixer_l, 0, freeverbs1, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord30(freeverbs1, 0, reverb_mixer_r, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord31(freeverbs1, 1, reverb_mixer_l, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord32(reverb_mixer_r, volume_r); |
|
|
|
|
|
|
|
AudioConnection patchCord33(reverb_mixer_l, volume_l); |
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
AudioConnection patchCord34(volume_r, 0, usb1, 0); |
|
|
|
AudioConnection patchCord23(volume_r, 0, usb1, 0); |
|
|
|
AudioConnection patchCord35(volume_l, 0, usb1, 1); |
|
|
|
AudioConnection patchCord24(volume_l, 0, usb1, 1); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
#if defined(TEENSY_AUDIO_BOARD) |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioConnection patchCord36(volume_r, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord25(volume_r, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord37(volume_l, 0, i2s1, 1); |
|
|
|
AudioConnection patchCord26(volume_l, 0, i2s1, 1); |
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
#elif defined(TGA_AUDIO_BOARD) |
|
|
|
#elif defined(TGA_AUDIO_BOARD) |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioConnection patchCord36(volume_r, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord27(volume_r, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord37(volume_l, 0, i2s1, 1); |
|
|
|
AudioConnection patchCord28(volume_l, 0, i2s1, 1); |
|
|
|
AudioControlWM8731master wm8731_1; |
|
|
|
AudioControlWM8731master wm8731_1; |
|
|
|
#else |
|
|
|
#else |
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
AudioConnection patchCord36(volume_r, 0, pt8211_1, 0); |
|
|
|
AudioConnection patchCord29(volume_r, 0, pt8211_1, 0); |
|
|
|
AudioConnection patchCord37(volume_l, 0, pt8211_1, 1); |
|
|
|
AudioConnection patchCord30(volume_l, 0, pt8211_1, 1); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
Dexed* dexed = new Dexed(SAMPLE_RATE); |
|
|
|
Dexed* dexed = new Dexed(SAMPLE_RATE); |
|
|
@ -158,8 +147,7 @@ value_change_t soften_filter_res = {0.0, 0}; |
|
|
|
value_change_t soften_filter_cut = {0.0, 0}; |
|
|
|
value_change_t soften_filter_cut = {0.0, 0}; |
|
|
|
|
|
|
|
|
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
// Allocate the delay lines for left and right channels
|
|
|
|
short l_delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
short delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
short r_delayline[MOD_DELAY_SAMPLE_BUFFER]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_LCD_UI |
|
|
|
#ifdef ENABLE_LCD_UI |
|
|
|
/***********************************************************************
|
|
|
|
/***********************************************************************
|
|
|
@ -302,14 +290,10 @@ void setup() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Init effects
|
|
|
|
// Init effects
|
|
|
|
if (!modchorus_r.begin(r_delayline, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
if (!modchorus.begin(delayline, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
Serial.println(F("AudioEffectModulatedDelay - right channel begin failed")); |
|
|
|
Serial.println(F("AudioEffectModulatedDelay - right channel begin failed")); |
|
|
|
while (1); |
|
|
|
while (1); |
|
|
|
} |
|
|
|
} |
|
|
|
if (!modchorus_l.begin(l_delayline, MOD_DELAY_SAMPLE_BUFFER)) { |
|
|
|
|
|
|
|
Serial.println(F("AudioEffectModulatedDelay - left channel begin failed")); |
|
|
|
|
|
|
|
while (1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
#ifdef DEBUG |
|
|
|
Serial.print(F("MOD_DELAY_SAMPLE_BUFFER=")); |
|
|
|
Serial.print(F("MOD_DELAY_SAMPLE_BUFFER=")); |
|
|
|
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC); |
|
|
|
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC); |
|
|
@ -321,38 +305,29 @@ void setup() |
|
|
|
modulator.offset(0.0); |
|
|
|
modulator.offset(0.0); |
|
|
|
#if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT |
|
|
|
#if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT |
|
|
|
// Butterworth filter, 12 db/octave
|
|
|
|
// Butterworth filter, 12 db/octave
|
|
|
|
modchorus_filter_r.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707); |
|
|
|
modchorus_filter.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707); |
|
|
|
modchorus_filter_l.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707); |
|
|
|
|
|
|
|
#elif MOD_FILTER_OUTPUT == MOD_LINKWITZ_RILEY_FILTER_OUTPUT |
|
|
|
#elif MOD_FILTER_OUTPUT == MOD_LINKWITZ_RILEY_FILTER_OUTPUT |
|
|
|
// Linkwitz-Riley filter, 48 dB/octave
|
|
|
|
// Linkwitz-Riley filter, 48 dB/octave
|
|
|
|
modchorus_filter_r.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
modchorus_filter.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
modchorus_filter_r.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
modchorus_filter.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
modchorus_filter_r.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
modchorus_filter.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
modchorus_filter_r.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
modchorus_filter.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
modchorus_filter_l.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
modchorus_filter.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
modchorus_filter_l.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
modchorus_filter.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
modchorus_filter_l.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
modchorus_filter.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54); |
|
|
|
modchorus_filter_l.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
modchorus_filter.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
chorus_mixer_r.gain(0, 1.0); |
|
|
|
chorus_mixer.gain(0, 1.0); |
|
|
|
chorus_mixer_l.gain(0, 1.0); |
|
|
|
chorus_mixer.gain(1, 0.0); |
|
|
|
chorus_mixer_r.gain(1, 0.0); |
|
|
|
|
|
|
|
chorus_mixer_l.gain(1, 0.0); |
|
|
|
delay1.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); |
|
|
|
|
|
|
|
// delay_fb_mixer is the feedback-adding mixer, delay_mixer_r the whole delay (with/without feedback) mixer
|
|
|
|
delay_r.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); |
|
|
|
delay_fb_mixer.gain(0, 1.0); // original signal
|
|
|
|
delay_l.delay(0, mapfloat(effect_delay_feedback, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME)); |
|
|
|
delay_fb_mixer.gain(1, mapfloat(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); // amount of feedback
|
|
|
|
// delay_fb_mixer_r is the feedback-adding mixer, delay_mixer_r the whole delay (with/without feedback) mixer
|
|
|
|
delay_mixer.gain(0, 1.0 - mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // original signal
|
|
|
|
delay_fb_mixer_r.gain(0, 1.0); // original signal
|
|
|
|
delay_mixer.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delayed signal (including feedback)
|
|
|
|
delay_fb_mixer_l.gain(0, 1.0); // original signal
|
|
|
|
delay_mixer.gain(2, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // only delayed signal (without feedback)
|
|
|
|
delay_fb_mixer_r.gain(1, mapfloat(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); // amount of feedback
|
|
|
|
|
|
|
|
delay_fb_mixer_l.gain(1, mapfloat(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0.0, 1.0)); // amount of feedback
|
|
|
|
|
|
|
|
delay_mixer_r.gain(0, 1.0 - mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // original signal
|
|
|
|
|
|
|
|
delay_mixer_l.gain(0, 1.0 - mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // original signal
|
|
|
|
|
|
|
|
delay_mixer_r.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delayed signal (including feedback)
|
|
|
|
|
|
|
|
delay_mixer_l.gain(1, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // delayed signal (including feedback)
|
|
|
|
|
|
|
|
delay_mixer_r.gain(2, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // only delayed signal (without feedback)
|
|
|
|
|
|
|
|
delay_mixer_l.gain(2, mapfloat(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0.0, 1.0)); // only delayed signal (without feedback)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reverb_mixer_r.gain(0, 1.0); |
|
|
|
reverb_mixer_r.gain(0, 1.0); |
|
|
|
reverb_mixer_l.gain(0, 1.0); |
|
|
|
reverb_mixer_l.gain(0, 1.0); |
|
|
@ -593,7 +568,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 105: // CC 105: delay time
|
|
|
|
case 105: // CC 105: delay time
|
|
|
|
effect_delay_time = map(inValue, 0, 127, 0, ENC_DELAY_TIME_STEPS); |
|
|
|
effect_delay_time = map(inValue, 0, 127, 0, ENC_DELAY_TIME_STEPS); |
|
|
|
////delay_r.delay(0, mapfloat(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME));
|
|
|
|
////delay.delay(0, mapfloat(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0.0, DELAY_MAX_TIME));
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case 106: // CC 106: delay feedback
|
|
|
|
case 106: // CC 106: delay feedback
|
|
|
|
effect_delay_feedback = map(inValue, 0, 127, 0, ENC_DELAY_FB_STEPS); |
|
|
|
effect_delay_feedback = map(inValue, 0, 127, 0, ENC_DELAY_FB_STEPS); |
|
|
|