|
|
|
@ -44,7 +44,7 @@ |
|
|
|
|
#include "Encoder4.h" |
|
|
|
|
#include "LiquidCrystalPlus_I2C.h" |
|
|
|
|
#include "UI.h" |
|
|
|
|
|
|
|
|
|
#include <BALibrary.h> // had rename libraries/BALibrary/src/peripherals/BAPhysicalControls.cpp |
|
|
|
|
|
|
|
|
|
//*************************************************************************************************
|
|
|
|
|
//* GLOBAL VARIABLES
|
|
|
|
@ -57,33 +57,44 @@ AudioAnalyzePeak peak_r; |
|
|
|
|
AudioAnalyzePeak peak_l; |
|
|
|
|
AudioEffectFreeverb freeverb_r; |
|
|
|
|
AudioEffectFreeverb freeverb_l; |
|
|
|
|
AudioMixer4 mixer_r; |
|
|
|
|
AudioMixer4 mixer_l; |
|
|
|
|
AudioMixer4 reverb_mixer_r; |
|
|
|
|
AudioMixer4 reverb_mixer_l; |
|
|
|
|
AudioEffectDelay delay_r; |
|
|
|
|
AudioEffectDelay delay_l; |
|
|
|
|
AudioMixer4 delay_mixer_r; |
|
|
|
|
AudioMixer4 delay_mixer_l; |
|
|
|
|
AudioConnection patchCord0(queue_r, peak_r); |
|
|
|
|
AudioConnection patchCord1(queue_l, peak_l); |
|
|
|
|
AudioConnection patchCord4(queue_r, freeverb_r); |
|
|
|
|
AudioConnection patchCord5(queue_l, freeverb_l); |
|
|
|
|
AudioConnection patchCord6(queue_r, 0, mixer_r, 0); |
|
|
|
|
AudioConnection patchCord7(queue_l, 0, mixer_l, 0); |
|
|
|
|
AudioConnection patchCord8(freeverb_r, 0, mixer_r, 1); |
|
|
|
|
AudioConnection patchCord9(freeverb_l, 0, mixer_l, 1); |
|
|
|
|
AudioConnection patchCord2(queue_r, delay_r); |
|
|
|
|
AudioConnection patchCord3(queue_l, delay_l); |
|
|
|
|
AudioConnection patchCord4(queue_r, 0, delay_mixer_r, 0); |
|
|
|
|
AudioConnection patchCord5(delay_r, 0, delay_mixer_r, 1); |
|
|
|
|
AudioConnection patchCord6(queue_l, 0, delay_mixer_l, 0); |
|
|
|
|
AudioConnection patchCord7(delay_l, 0, delay_mixer_l, 1); |
|
|
|
|
AudioConnection patchCord8(delay_mixer_r, freeverb_r); |
|
|
|
|
AudioConnection patchCord9(delay_mixer_l, freeverb_l); |
|
|
|
|
AudioConnection patchCord10(delay_mixer_r, 0, reverb_mixer_r, 0); |
|
|
|
|
AudioConnection patchCord11(delay_mixer_l, 0, reverb_mixer_l, 0); |
|
|
|
|
AudioConnection patchCord12(freeverb_r, 0, reverb_mixer_r, 1); |
|
|
|
|
AudioConnection patchCord13(freeverb_l, 0, reverb_mixer_l, 1); |
|
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord110(mixer_r, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord111(mixer_l, 0, i2s1, 1); |
|
|
|
|
AudioConnection patchCord14(reverb_mixer_r, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord15(reverb_mixer_l, 0, i2s1, 1); |
|
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
|
#else |
|
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
|
AudioAmplifier volume_r; |
|
|
|
|
AudioAmplifier volume_l; |
|
|
|
|
AudioConnection patchCord10(mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord11(mixer_l, volume_l); |
|
|
|
|
AudioConnection patchCord12(volume_r, 0, pt8211_1, 1); |
|
|
|
|
AudioConnection patchCord13(volume_l, 0, pt8211_1, 0); |
|
|
|
|
AudioConnection patchCord14(reverb_mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord15(reverb_mixer_l, volume_l); |
|
|
|
|
AudioConnection patchCord16(volume_r, 0, pt8211_1, 1); |
|
|
|
|
AudioConnection patchCord17(volume_l, 0, pt8211_1, 0); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Objects
|
|
|
|
|
mdaEPiano* ep; |
|
|
|
|
BALibrary::LowFrequencyOscillatorVector<float> chorus_lfo; |
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
|
MIDI_CREATE_INSTANCE(HardwareSerial, MIDI_DEVICE_DIN, midi_serial); |
|
|
|
@ -127,6 +138,7 @@ void setup() |
|
|
|
|
Serial.begin(SERIAL_SPEED); |
|
|
|
|
delay(220); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// LCD display setup
|
|
|
|
|
lcd.init(); |
|
|
|
|
lcd.blink_off(); |
|
|
|
@ -145,7 +157,7 @@ void setup() |
|
|
|
|
enc_val[1] = enc[1].read(); |
|
|
|
|
but[0].update(); |
|
|
|
|
but[1].update(); |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
// Debug output
|
|
|
|
|
Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst")); |
|
|
|
|
Serial.println(F("(c)2018 H. Wirtz <wirtz@parasitstudio.de>")); |
|
|
|
@ -208,6 +220,7 @@ void setup() |
|
|
|
|
Serial.print(1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES)); |
|
|
|
|
Serial.println(F("ms)")); |
|
|
|
|
|
|
|
|
|
// Epiano
|
|
|
|
|
ep->setParameter(DECAY, 0.5); |
|
|
|
|
ep->setParameter(RELEASE, 0.5); |
|
|
|
|
ep->setParameter(HARDNESS, 0.7); |
|
|
|
@ -217,14 +230,24 @@ void setup() |
|
|
|
|
ep->setParameter(STEREO, 0.7); |
|
|
|
|
ep->setParameter(OVERDRIVE, 0.3); |
|
|
|
|
|
|
|
|
|
// Reverb
|
|
|
|
|
freeverb_r.roomsize(0.2); |
|
|
|
|
freeverb_l.roomsize(0.2); |
|
|
|
|
freeverb_r.damping(0.5); |
|
|
|
|
freeverb_l.damping(0.5); |
|
|
|
|
mixer_r.gain(0, 0.7); |
|
|
|
|
mixer_l.gain(0, 0.7); |
|
|
|
|
mixer_r.gain(1, 0.3); |
|
|
|
|
mixer_l.gain(1, 0.3); |
|
|
|
|
reverb_mixer_r.gain(0, 0.7); |
|
|
|
|
reverb_mixer_l.gain(0, 0.7); |
|
|
|
|
reverb_mixer_r.gain(1, 0.3); |
|
|
|
|
reverb_mixer_l.gain(1, 0.3); |
|
|
|
|
|
|
|
|
|
// Chorus
|
|
|
|
|
delay_mixer_r.gain(0, 1.0 - DELAY_VOLUME); |
|
|
|
|
delay_mixer_r.gain(1, DELAY_VOLUME); |
|
|
|
|
delay_mixer_l.gain(0, 1.0 - DELAY_VOLUME); |
|
|
|
|
delay_mixer_l.gain(1, DELAY_VOLUME); |
|
|
|
|
delay_r.delay(0, DELAY_R_MS); |
|
|
|
|
delay_l.delay(0, DELAY_L_MS); |
|
|
|
|
chorus_lfo.setRateAudio(DELAY_FRQ); |
|
|
|
|
|
|
|
|
|
Serial.println(F("<setup end>")); |
|
|
|
|
|
|
|
|
@ -295,6 +318,11 @@ void loop() |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
float c = *chorus_lfo.getNextVector(); |
|
|
|
|
|
|
|
|
|
delay_r.delay(0, DELAY_R_MS / 2 * c * DELAY_R_INTENSITY + DELAY_R_MS / 2); |
|
|
|
|
delay_l.delay(0, DELAY_L_MS / 2 * c * DELAY_R_INTENSITY + DELAY_L_MS / 2); |
|
|
|
|
|
|
|
|
|
queue_r.playBuffer(); |
|
|
|
|
queue_l.playBuffer(); |
|
|
|
|
} |
|
|
|
|