Audio chain fixed.

pull/32/head
Holger Wirtz 5 years ago
parent 4ea0ced615
commit b0e432a9e0
  1. 118
      MicroDexed.ino

@ -53,62 +53,47 @@ AudioAmplifier modchorus_inverter;
// FX chain left // FX chain left
AudioMixer4 delay_send_mixer_l; AudioMixer4 delay_send_mixer_l;
AudioMixer4 delay_mixer_l;
AudioMixer4 delay_fb_mixer_l; AudioMixer4 delay_fb_mixer_l;
AudioEffectDelay delay_l; AudioEffectDelay delay_l;
AudioConnection patchCord1(delay_send_mixer_l, 0, delay_fb_mixer_l, 0); AudioConnection patchCord1(delay_send_mixer_l, 0, delay_fb_mixer_l, 0);
AudioConnection patchCord2(delay_fb_mixer_l, delay_l); AudioConnection patchCord2(delay_fb_mixer_l, delay_l);
AudioConnection patchCord3(delay_l, 0, delay_fb_mixer_l, 1); // feedback-loop AudioConnection patchCord3(delay_l, 0, delay_fb_mixer_l, 1); // feedback-loop
AudioConnection patchCord4(delay_l, 0, delay_mixer_l, 0);
AudioConnection patchCord5(delay_fb_mixer_l, 0, delay_mixer_l, 1);
AudioConnection patchCord6(delay_mixer_l, 0, master_mixer_l, DELAY);
AudioMixer4 chorus_send_mixer_l; AudioMixer4 chorus_send_mixer_l;
AudioEffectModulatedDelay modchorus_l; AudioEffectModulatedDelay modchorus_l;
AudioConnection patchCord7(chorus_send_mixer_l, 0, modchorus_l, 0); AudioConnection patchCord4(chorus_send_mixer_l, 0, modchorus_l, 0);
AudioConnection patchCord8(chorus_modulator, 0, modchorus_l, 1); AudioConnection patchCord5(chorus_modulator, 0, modchorus_l, 1);
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioFilterBiquad modchorus_filter_l; AudioFilterBiquad modchorus_filter_l;
AudioConnection patchCord9(modchorus_l, modchorus_filter_l); AudioConnection patchCord6(modchorus_l, modchorus_filter_l);
AudioConnection patchCord10(modchorus_filter_l, modchorus_inverter); AudioConnection patchCord7(modchorus_filter_l, modchorus_inverter);
AudioConnection patchCord11(modchorus_inverter_l, 0, master_mixer_l, CHORUS);
#else #else
AudioConnection patchCord9(modchorus_l, modchorus_inverter); AudioConnection patchCord6(modchorus_l, modchorus_inverter);
AudioConnection patchCord10(modchorus_inverter, 0, master_mixer_l, CHORUS);
#endif #endif
#if defined(USE_REVERB) #if defined(USE_REVERB)
AudioMixer4 reverb_send_mixer_l; AudioMixer4 reverb_send_mixer_l;
AudioEffectFreeverb freeverb_l; AudioEffectFreeverb freeverb_l;
AudioConnection patchCord12(reverb_send_mixer_l, freeverb_l); AudioConnection patchCord8(reverb_send_mixer_l, freeverb_l);
AudioConnection patchCord13(freeverb_l, 0, master_mixer_r, REVERB);
#endif #endif
// FX chain right // FX chain right
AudioMixer4 delay_send_mixer_r; AudioMixer4 delay_send_mixer_r;
AudioMixer4 delay_mixer_r;
AudioMixer4 delay_fb_mixer_r; AudioMixer4 delay_fb_mixer_r;
AudioEffectDelay delay_r; AudioEffectDelay delay_r;
AudioConnection patchCord14(delay_send_mixer_r, 0, delay_fb_mixer_r, 0); AudioConnection patchCord9(delay_send_mixer_r, 0, delay_fb_mixer_r, 0);
AudioConnection patchCord15(delay_fb_mixer_r, delay_r); AudioConnection patchCord10(delay_fb_mixer_r, delay_r);
AudioConnection patchCord16(delay_r, 0, delay_fb_mixer_r, 1); // feedback-loop AudioConnection patchCord11(delay_r, 0, delay_fb_mixer_r, 1); // feedback-loop
AudioConnection patchCord17(delay_r, 0, delay_mixer_r, 0);
AudioConnection patchCord18(delay_fb_mixer_r, 0, delay_mixer_r, 1);
AudioConnection patchCord19(delay_mixer_r, 0, master_mixer_r, DELAY);
AudioMixer4 chorus_send_mixer_r; AudioMixer4 chorus_send_mixer_r;
AudioConnection patchCord20(chorus_send_mixer_r, modchorus_r); AudioConnection patchCord12(chorus_send_mixer_r, modchorus_r);
AudioEffectModulatedDelay modchorus_r; AudioEffectModulatedDelay modchorus_r;
AudioConnection patchCord21(chorus_modulator, 0, modchorus_r, 1); AudioConnection patchCord13(chorus_modulator, 0, modchorus_r, 1);
#if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioFilterBiquad modchorus_filter_r; AudioFilterBiquad modchorus_filter_r;
AudioConnection patchCord22(modchorus_r, modchorus_filter_r); AudioConnection patchCord14(modchorus_r, modchorus_filter_r);
AudioConnection patchCord23(modchorus_filter_r, 0, master_mixer_r, CHORUS);
#else
AudioConnection patchCord22(modchorus_r, 0, master_mixer_r, CHORUS);
#endif #endif
#if defined(USE_REVERB) #if defined(USE_REVERB)
AudioMixer4 reverb_send_mixer_r; AudioMixer4 reverb_send_mixer_r;
AudioEffectFreeverb freeverb_r; AudioEffectFreeverb freeverb_r;
AudioConnection patchCord24(reverb_send_mixer_r, freeverb_r); AudioConnection patchCord15(reverb_send_mixer_r, freeverb_r);
AudioConnection patchCord25(freeverb_r, 0, master_mixer_r, REVERB);
#endif #endif
// FX chain tail // FX chain tail
@ -121,50 +106,63 @@ AudioAmplifier volume_l;
AudioEffectStereoMono stereo2mono; AudioEffectStereoMono stereo2mono;
AudioAnalyzePeak master_peak_r; AudioAnalyzePeak master_peak_r;
AudioAnalyzePeak master_peak_l; AudioAnalyzePeak master_peak_l;
AudioConnection patchCord26(dexed_mixer_r, 0, master_mixer_r, DEXED); AudioConnection patchCord16(delay_fb_mixer_r, 0, master_mixer_r, DELAY);
AudioConnection patchCord27(dexed_mixer_l, 0, master_mixer_l, DEXED); AudioConnection patchCord17(delay_fb_mixer_l, 0, master_mixer_l, DELAY);
AudioConnection patchCord28(master_mixer_r, volume_r); #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioConnection patchCord29(master_mixer_l, volume_l); AudioConnection patchCord18(modchorus_filter_r, 0, master_mixer_r, CHORUS);
AudioConnection patchCord30(volume_r, 0, stereo2mono, 0); AudioConnection patchCord19(modchorus_inverter, 0, master_mixer_l, CHORUS);
AudioConnection patchCord31(volume_l, 0, stereo2mono, 1); #else
AudioConnection patchCord32(volume_r, master_peak_r); AudioConnection patchCord18(modchorus_r, 0, master_mixer_r, CHORUS);
AudioConnection patchCord33(volume_l, master_peak_l); AudioConnection patchCord19(modchorus_inverter, 0, master_mixer_l, CHORUS);
AudioConnection patchCord34(microdexed_peak_mixer, microdexed_peak); #endif
#if defined(USE_REVERB)
AudioConnection patchCord20(freeverb_r, 0, master_mixer_r, REVERB);
AudioConnection patchCord21(freeverb_l, 0, master_mixer_l, REVERB);
#endif
AudioConnection patchCord22(dexed_mixer_r, 0, master_mixer_r, DEXED);
AudioConnection patchCord23(dexed_mixer_l, 0, master_mixer_l, DEXED);
AudioConnection patchCord24(master_mixer_r, volume_r);
AudioConnection patchCord25(master_mixer_l, volume_l);
AudioConnection patchCord26(volume_r, 0, stereo2mono, 0);
AudioConnection patchCord27(volume_l, 0, stereo2mono, 1);
AudioConnection patchCord28(volume_r, master_peak_r);
AudioConnection patchCord29(volume_l, master_peak_l);
AudioConnection patchCord30(microdexed_peak_mixer, microdexed_peak);
// Outputs // Outputs
#ifdef AUDIO_DEVICE_USB #ifdef AUDIO_DEVICE_USB
AudioOutputUSB usb1; AudioOutputUSB usb1;
AudioConnection patchCord35(stereo2mono, 0, usb1, 0); AudioConnection patchCord31(stereo2mono, 0, usb1, 0);
AudioConnection patchCord36(stereo2mono, 1, usb1, 1); AudioConnection patchCord32(stereo2mono, 1, usb1, 1);
#endif #endif
#if defined(TEENSY_AUDIO_BOARD) #if defined(TEENSY_AUDIO_BOARD)
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord37(stereo2mono, 0, i2s1, 0); AudioConnection patchCord33(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord38(stereo2mono, 1, i2s1, 1); AudioConnection patchCord34(stereo2mono, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
#elif defined (I2S_AUDIO_ONLY) #elif defined (I2S_AUDIO_ONLY)
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord37(stereo2mono, 0, i2s1, 0); AudioConnection patchCord33(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord38(stereo2mono, 1, i2s1, 1); AudioConnection patchCord34(stereo2mono, 1, i2s1, 1);
#elif defined(TGA_AUDIO_BOARD) #elif defined(TGA_AUDIO_BOARD)
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord37(stereo2mono, 0, i2s1, 0); AudioConnection patchCord33(stereo2mono, 0, i2s1, 0);
AudioConnection patchCord38(stereo2mono, 1, i2s1, 1); AudioConnection patchCord34(stereo2mono, 1, i2s1, 1);
AudioControlWM8731master wm8731_1; AudioControlWM8731master wm8731_1;
#elif defined(PT8211_AUDIO) #elif defined(PT8211_AUDIO)
AudioOutputPT8211 pt8211_1; AudioOutputPT8211 pt8211_1;
AudioConnection patchCord37(stereo2mono, 0, pt8211_1, 0); AudioConnection patchCord33(stereo2mono, 0, pt8211_1, 0);
AudioConnection patchCord38(stereo2mono, 1, pt8211_1, 1); AudioConnection patchCord34(stereo2mono, 1, pt8211_1, 1);
#elif defined(TEENSY_DAC_SYMMETRIC) #elif defined(TEENSY_DAC_SYMMETRIC)
AudioOutputAnalogStereo dacOut; AudioOutputAnalogStereo dacOut;
AudioMixer4 invMixer; AudioMixer4 invMixer;
AudioConnection patchCord37(stereo2mono, 0, dacOut , 0); AudioConnection patchCord33(stereo2mono, 0, dacOut , 0);
AudioConnection patchCord38(stereo2mono, 1, invMixer, 0); AudioConnection patchCord34(stereo2mono, 1, invMixer, 0);
AudioConnection patchCord39(invMixer, 0, dacOut , 1); AudioConnection patchCord35(invMixer, 0, dacOut , 1);
#else #else
AudioOutputAnalogStereo dacOut; AudioOutputAnalogStereo dacOut;
AudioConnection patchCord37(stereo2mono, 0, dacOut, 0); AudioConnection patchCord33(stereo2mono, 0, dacOut, 0);
AudioConnection patchCord38(stereo2mono, 1, dacOut, 1); AudioConnection patchCord34(stereo2mono, 1, dacOut, 1);
#endif #endif
// //
@ -180,24 +178,24 @@ void create_audio_connections(AudioSourceMicroDexed &dexed, AudioEffectMonoStere
{ {
Serial.print(F("Connecting Dexed ")); Serial.print(F("Connecting Dexed "));
Serial.print(instance_id, DEC); Serial.print(instance_id, DEC);
Serial.println(F(" -> ")); Serial.println(F(":"));
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, microdexed_peak_mixer, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, microdexed_peak_mixer, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, mono2stereo, 0); dynamicConnections[nDynamic++] = new AudioConnection(dexed, 0, mono2stereo, 0);
dynamicConnections[nDynamic++] = new AudioConnection(pan, 0, mono2stereo, 1); dynamicConnections[nDynamic++] = new AudioConnection(pan, 0, mono2stereo, 1);
Serial.println(F(" Peakmeter")); Serial.println(F(" -> Peakmeter"));
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, dexed_mixer_r, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, dexed_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, dexed_mixer_l, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, dexed_mixer_l, instance_id);
Serial.println(F(" Dexed mixer")); Serial.println(F(" -> Dexed mixer"));
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_r, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, chorus_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, chorus_send_mixer_l, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, chorus_send_mixer_l, instance_id);
Serial.println(F(" Chorus send")); Serial.println(F(" -> Chorus send"));
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_r, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, delay_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, delay_send_mixer_l, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, delay_send_mixer_l, instance_id);
Serial.println(F(" Delay send")); Serial.println(F(" -> Delay send"));
#if defined(USE_REVERB) #if defined(USE_REVERB)
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, reverb_send_mixer_r, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 0, reverb_send_mixer_r, instance_id);
dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, reverb_send_mixer_l, instance_id); dynamicConnections[nDynamic++] = new AudioConnection(mono2stereo, 1, reverb_send_mixer_l, instance_id);
Serial.println(F(" Reverb send")); Serial.println(F(" -> Reverb send"));
#endif #endif
} }
@ -491,10 +489,6 @@ void setup()
delay_fb_mixer_r.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback delay_fb_mixer_r.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
delay_fb_mixer_l.gain(0, 1.0); // original signal delay_fb_mixer_l.gain(0, 1.0); // original signal
delay_fb_mixer_l.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback delay_fb_mixer_l.gain(1, mapfloat(configuration.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback
delay_mixer_r.gain(0, 1.0);
delay_mixer_l.gain(0, 1.0);
delay_mixer_r.gain(1, 1.0);
delay_mixer_l.gain(1, 1.0);
// CHORUS // CHORUS
switch (configuration.chorus_waveform) switch (configuration.chorus_waveform)

Loading…
Cancel
Save