Added inverter for second modulated delay as stereo chorus simulation.

master
Holger Wirtz 6 years ago
parent da5ca32be0
commit f196fe60cd
  1. 51
      MicroMDAEPiano.ino
  2. 2
      config.h
  3. 2
      effect_modulated_delay.cpp
  4. 4
      effect_modulated_delay.h

@ -53,6 +53,7 @@ AudioMixer4 mixer_r;
AudioMixer4 mixer_l; AudioMixer4 mixer_l;
AudioAmplifier volume_r; AudioAmplifier volume_r;
AudioAmplifier volume_l; AudioAmplifier volume_l;
AudioAmplifier inverter;
AudioEffectModulatedDelay modchorus_r; AudioEffectModulatedDelay modchorus_r;
AudioEffectModulatedDelay modchorus_l; AudioEffectModulatedDelay modchorus_l;
AudioSynthWaveform modulator; AudioSynthWaveform modulator;
@ -63,24 +64,25 @@ AudioConnection patchCord3(queue_l, freeverb_l);
AudioConnection patchCord4(queue_r, 0, modchorus_r, 0); AudioConnection patchCord4(queue_r, 0, modchorus_r, 0);
AudioConnection patchCord5(queue_l, 0, modchorus_l, 0); AudioConnection patchCord5(queue_l, 0, modchorus_l, 0);
AudioConnection patchCord6(modulator, 0, modchorus_r, 1); AudioConnection patchCord6(modulator, 0, modchorus_r, 1);
AudioConnection patchCord7(modulator, 0, modchorus_l, 1); AudioConnection patchCord7(modulator, inverter);
AudioConnection patchCord8(queue_r, 0, mixer_r, 0); AudioConnection patchCord8(inverter, 0, modchorus_l, 1);
AudioConnection patchCord9(queue_l, 0, mixer_l, 0); AudioConnection patchCord9(queue_r, 0, mixer_r, 0);
AudioConnection patchCord10(modchorus_r, 0, mixer_r, 2); AudioConnection patchCord10(queue_l, 0, mixer_l, 0);
AudioConnection patchCord11(modchorus_l, 0, mixer_l, 2); AudioConnection patchCord11(modchorus_r, 0, mixer_r, 2);
AudioConnection patchCord12(freeverb_r, 0, mixer_r, 1); AudioConnection patchCord12(modchorus_l, 0, mixer_l, 2);
AudioConnection patchCord13(freeverb_l, 0, mixer_l, 1); AudioConnection patchCord13(freeverb_r, 0, mixer_r, 1);
AudioConnection patchCord14(mixer_r, volume_r); AudioConnection patchCord14(freeverb_l, 0, mixer_l, 1);
AudioConnection patchCord15(mixer_l, volume_l); AudioConnection patchCord15(mixer_r, volume_r);
AudioConnection patchCord16(mixer_l, volume_l);
#if defined(TEENSY_AUDIO_BOARD) #if defined(TEENSY_AUDIO_BOARD)
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord16(volume_r, 0, i2s1, 0); AudioConnection patchCord17(volume_r, 0, i2s1, 0);
AudioConnection patchCord17(volume_l, 0, i2s1, 1); AudioConnection patchCord18(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 patchCord16(volume_r, 0, i2s1, 1); AudioConnection patchCord17(volume_r, 0, i2s1, 1);
AudioConnection patchCord17(volume_l, 0, i2s1, 0); AudioConnection patchCord18(volume_l, 0, i2s1, 0);
AudioControlWM8731master wm8731_1; AudioControlWM8731master wm8731_1;
#else #else
AudioOutputPT8211 pt8211_1; AudioOutputPT8211 pt8211_1;
@ -153,8 +155,8 @@ elapsedMillis cpu_mem_millis;
#endif #endif
// Allocate the delay lines for left and right channels // Allocate the delay lines for left and right channels
short l_delayline[CHORUS_DELAY_LENGTH_BYTES]; short l_delayline[CHORUS_DELAY_LENGTH_SAMPLES];
short r_delayline[CHORUS_DELAY_LENGTH_BYTES]; short r_delayline[CHORUS_DELAY_LENGTH_SAMPLES];
//************************************************************************************************* //*************************************************************************************************
//* SETUP FUNCTION //* SETUP FUNCTION
@ -226,11 +228,11 @@ void setup()
Serial.print(audio_block_time_us); Serial.print(audio_block_time_us);
Serial.println(F("us)")); Serial.println(F("us)"));
if (!modchorus_r.begin(r_delayline, CHORUS_DELAY_LENGTH_BYTES)) { if (!modchorus_r.begin(r_delayline, CHORUS_DELAY_LENGTH_SAMPLES)) {
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, CHORUS_DELAY_LENGTH_BYTES)) { if (!modchorus_l.begin(l_delayline, CHORUS_DELAY_LENGTH_SAMPLES)) {
Serial.println(F("AudioEffectModulatedDelay - left channel begin failed")); Serial.println(F("AudioEffectModulatedDelay - left channel begin failed"));
while (1); while (1);
} }
@ -241,16 +243,15 @@ void setup()
modulator.frequency(1.0); modulator.frequency(1.0);
modulator.phase(0); modulator.phase(0);
modulator.offset(0.0); modulator.offset(0.0);
inverter.gain(-1.0); // change phase for second moduleated delay
// internal mixing of original signal(0), reverb(1) and chorus(2) // internal mixing of original signal(0), reverb(1) and chorus(2)
//mixer_r.gain(0, 1.0); mixer_r.gain(0, 1.0);
//mixer_l.gain(0, 1.0); mixer_l.gain(0, 1.0);
mixer_r.gain(0, 0.0); mixer_r.gain(1, 0.5);
mixer_l.gain(0, 0.0); mixer_l.gain(1, 0.5);
mixer_r.gain(1, 0.0); mixer_r.gain(2, 0.5);
mixer_l.gain(1, 0.0); mixer_l.gain(2, 0.5);
mixer_r.gain(2, 1.0);
mixer_l.gain(2, 1.0);
// set master volume // set master volume
set_master_volume(master_volume); set_master_volume(master_volume);

@ -64,7 +64,7 @@
#define INTERPOLATION_WINDOW_SIZE 7 // use only odd numbers!!! #define INTERPOLATION_WINDOW_SIZE 7 // use only odd numbers!!!
#define INTERPOLATE QUADRATIC // LINEAR QUADRATIC COSINE CUBIC LAGRANGE #define INTERPOLATE QUADRATIC // LINEAR QUADRATIC COSINE CUBIC LAGRANGE
#define CHORUS_WAVEFORM WAVEFORM_SINE // WAVEFORM_SINE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE WAVEFORM_SQUARE WAVEFORM_TRIANGLE #define CHORUS_WAVEFORM WAVEFORM_SINE // WAVEFORM_SINE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE WAVEFORM_SQUARE WAVEFORM_TRIANGLE
#define CHORUS_DELAY_LENGTH_BYTES (16*AUDIO_BLOCK_SAMPLES) #define CHORUS_DELAY_LENGTH_SAMPLES (16*AUDIO_BLOCK_SAMPLES)
//************************************************************************************************* //*************************************************************************************************
//* DEBUG OUTPUT SETTINGS //* DEBUG OUTPUT SETTINGS

@ -30,7 +30,7 @@
/******************************************************************/ /******************************************************************/
// Based on; A u d i o E f f e c t C h o r u s // Based on; A u d i o E f f e c t D e l a y
// Written by Pete (El Supremo) Jan 2014 // Written by Pete (El Supremo) Jan 2014
// 140529 - change to handle mono stream - change modify() to voices() // 140529 - change to handle mono stream - change modify() to voices()
// 140219 - correct storage class (not static) // 140219 - correct storage class (not static)

@ -27,9 +27,9 @@
#include "Arduino.h" #include "Arduino.h"
#include "AudioStream.h" #include "AudioStream.h"
/******************************************************************/ /*************************************************************************/
// A u d i o E f f e c t C h o r u s // A u d i o E f f e c t M o d u l a t e d D e l a y
// Written by Pete (El Supremo) Jan 2014 // Written by Pete (El Supremo) Jan 2014
// 140219 - correct storage class (not static) // 140219 - correct storage class (not static)
// 190527 - added modulation input handling (by Holger Wirtz) // 190527 - added modulation input handling (by Holger Wirtz)

Loading…
Cancel
Save