|
|
@ -34,7 +34,7 @@ |
|
|
|
#else |
|
|
|
#else |
|
|
|
#include "mdaEPianoData.h" |
|
|
|
#include "mdaEPianoData.h" |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#if defined(MIDI_DEVICE_USB) |
|
|
|
#ifdef MIDI_DEVICE_USB |
|
|
|
#include <midi_UsbTransport.h> |
|
|
|
#include <midi_UsbTransport.h> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
|
#ifdef MIDI_DEVICE_USB_HOST |
|
|
@ -44,7 +44,10 @@ |
|
|
|
#include "Encoder4.h" |
|
|
|
#include "Encoder4.h" |
|
|
|
#include "LiquidCrystalPlus_I2C.h" |
|
|
|
#include "LiquidCrystalPlus_I2C.h" |
|
|
|
#include "UI.h" |
|
|
|
#include "UI.h" |
|
|
|
|
|
|
|
#include <BALibrary.h> // had rename libraries/BALibrary/src/peripherals/BAPhysicalControls.cpp |
|
|
|
|
|
|
|
#include <BAEffects.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace BAEffects; |
|
|
|
|
|
|
|
|
|
|
|
//*************************************************************************************************
|
|
|
|
//*************************************************************************************************
|
|
|
|
//* GLOBAL VARIABLES
|
|
|
|
//* GLOBAL VARIABLES
|
|
|
@ -57,33 +60,40 @@ AudioAnalyzePeak peak_r; |
|
|
|
AudioAnalyzePeak peak_l; |
|
|
|
AudioAnalyzePeak peak_l; |
|
|
|
AudioEffectFreeverb freeverb_r; |
|
|
|
AudioEffectFreeverb freeverb_r; |
|
|
|
AudioEffectFreeverb freeverb_l; |
|
|
|
AudioEffectFreeverb freeverb_l; |
|
|
|
AudioMixer4 mixer_r; |
|
|
|
AudioMixer4 reverb_mixer_r; |
|
|
|
AudioMixer4 mixer_l; |
|
|
|
AudioMixer4 reverb_mixer_l; |
|
|
|
|
|
|
|
AudioEffectSimpleChorus chorus_r(20.0); |
|
|
|
|
|
|
|
AudioEffectSimpleChorus chorus_l(20.0); |
|
|
|
|
|
|
|
//BAEffects::AudioEffectAnalogDelay chorus_r(200.0);
|
|
|
|
|
|
|
|
//BAEffects::AudioEffectAnalogDelay chorus_l(200.0);
|
|
|
|
AudioConnection patchCord0(queue_r, peak_r); |
|
|
|
AudioConnection patchCord0(queue_r, peak_r); |
|
|
|
AudioConnection patchCord1(queue_l, peak_l); |
|
|
|
AudioConnection patchCord1(queue_l, peak_l); |
|
|
|
AudioConnection patchCord4(queue_r, freeverb_r); |
|
|
|
AudioConnection patchCord2(queue_r, chorus_r); |
|
|
|
AudioConnection patchCord5(queue_l, freeverb_l); |
|
|
|
AudioConnection patchCord3(queue_l, chorus_l); |
|
|
|
AudioConnection patchCord6(queue_r, 0, mixer_r, 0); |
|
|
|
AudioConnection patchCord4(chorus_r, freeverb_r); |
|
|
|
AudioConnection patchCord7(queue_l, 0, mixer_l, 0); |
|
|
|
AudioConnection patchCord5(chorus_l, freeverb_l); |
|
|
|
AudioConnection patchCord8(freeverb_r, 0, mixer_r, 1); |
|
|
|
AudioConnection patchCord6(chorus_r, 0, reverb_mixer_r, 0); |
|
|
|
AudioConnection patchCord9(freeverb_l, 0, mixer_l, 1); |
|
|
|
AudioConnection patchCord7(chorus_l, 0, reverb_mixer_l, 0); |
|
|
|
|
|
|
|
AudioConnection patchCord8(freeverb_r, 0, reverb_mixer_r, 1); |
|
|
|
|
|
|
|
AudioConnection patchCord9(freeverb_l, 0, reverb_mixer_l, 1); |
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioOutputI2S i2s1; |
|
|
|
AudioConnection patchCord110(mixer_r, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord10(reverb_mixer_r, 0, i2s1, 0); |
|
|
|
AudioConnection patchCord111(mixer_l, 0, i2s1, 1); |
|
|
|
AudioConnection patchCord11(reverb_mixer_l, 0, i2s1, 1); |
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
AudioControlSGTL5000 sgtl5000_1; |
|
|
|
#else |
|
|
|
#else |
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
AudioOutputPT8211 pt8211_1; |
|
|
|
AudioAmplifier volume_r; |
|
|
|
AudioAmplifier volume_r; |
|
|
|
AudioAmplifier volume_l; |
|
|
|
AudioAmplifier volume_l; |
|
|
|
AudioConnection patchCord10(mixer_r, volume_r); |
|
|
|
AudioConnection patchCord10(reverb_mixer_r, volume_r); |
|
|
|
AudioConnection patchCord11(mixer_l, volume_l); |
|
|
|
AudioConnection patchCord11(reverb_mixer_l, volume_l); |
|
|
|
AudioConnection patchCord12(volume_r, 0, pt8211_1, 1); |
|
|
|
AudioConnection patchCord12(volume_r, 0, pt8211_1, 1); |
|
|
|
AudioConnection patchCord13(volume_l, 0, pt8211_1, 0); |
|
|
|
AudioConnection patchCord13(volume_l, 0, pt8211_1, 0); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Objects
|
|
|
|
// Objects
|
|
|
|
mdaEPiano* ep; |
|
|
|
mdaEPiano* ep; |
|
|
|
|
|
|
|
BALibrary::LowFrequencyOscillatorVector<float> chorus_lfo; |
|
|
|
|
|
|
|
|
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
#ifdef MIDI_DEVICE_DIN |
|
|
|
MIDI_CREATE_INSTANCE(HardwareSerial, MIDI_DEVICE_DIN, midi_serial); |
|
|
|
MIDI_CREATE_INSTANCE(HardwareSerial, MIDI_DEVICE_DIN, midi_serial); |
|
|
@ -105,7 +115,7 @@ uint32_t xrun = 0; |
|
|
|
uint32_t overload = 0; |
|
|
|
uint32_t overload = 0; |
|
|
|
uint32_t peak = 0; |
|
|
|
uint32_t peak = 0; |
|
|
|
uint16_t render_time_max = 0; |
|
|
|
uint16_t render_time_max = 0; |
|
|
|
float vol = VOLUME; |
|
|
|
float vol = _VOLUME; |
|
|
|
float vol_right = 1.0; |
|
|
|
float vol_right = 1.0; |
|
|
|
float vol_left = 1.0; |
|
|
|
float vol_left = 1.0; |
|
|
|
elapsedMicros fill_audio_buffer; |
|
|
|
elapsedMicros fill_audio_buffer; |
|
|
@ -127,25 +137,26 @@ void setup() |
|
|
|
Serial.begin(SERIAL_SPEED); |
|
|
|
Serial.begin(SERIAL_SPEED); |
|
|
|
delay(220); |
|
|
|
delay(220); |
|
|
|
|
|
|
|
|
|
|
|
// LCD display setup
|
|
|
|
/*
|
|
|
|
lcd.init(); |
|
|
|
// LCD display setup
|
|
|
|
lcd.blink_off(); |
|
|
|
lcd.init(); |
|
|
|
lcd.cursor_off(); |
|
|
|
lcd.blink_off(); |
|
|
|
lcd.backlight(); |
|
|
|
lcd.cursor_off(); |
|
|
|
lcd.noAutoscroll(); |
|
|
|
lcd.backlight(); |
|
|
|
lcd.clear(); |
|
|
|
lcd.noAutoscroll(); |
|
|
|
lcd.display(); |
|
|
|
lcd.clear(); |
|
|
|
lcd.show(0, 0, 20, " MicroMDAEPiano"); |
|
|
|
lcd.display(); |
|
|
|
lcd.show(1, 0, 16, "(c)parasiTstudio"); |
|
|
|
lcd.show(0, 0, 20, " MicroMDAEPiano"); |
|
|
|
|
|
|
|
lcd.show(1, 0, 16, "(c)parasiTstudio"); |
|
|
|
// Encoder setup
|
|
|
|
|
|
|
|
enc[0].write(INITIAL_ENC_L_VALUE); |
|
|
|
// Encoder setup
|
|
|
|
enc_val[0] = enc[0].read(); |
|
|
|
enc[0].write(INITIAL_ENC_L_VALUE); |
|
|
|
enc[1].write(INITIAL_ENC_R_VALUE); |
|
|
|
enc_val[0] = enc[0].read(); |
|
|
|
enc_val[1] = enc[1].read(); |
|
|
|
enc[1].write(INITIAL_ENC_R_VALUE); |
|
|
|
but[0].update(); |
|
|
|
enc_val[1] = enc[1].read(); |
|
|
|
but[1].update(); |
|
|
|
but[0].update(); |
|
|
|
|
|
|
|
but[1].update(); |
|
|
|
|
|
|
|
*/ |
|
|
|
// Debug output
|
|
|
|
// Debug output
|
|
|
|
Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst")); |
|
|
|
Serial.println(F("MicroMDAEPiano based on https://sourceforge.net/projects/mda-vst")); |
|
|
|
Serial.println(F("(c)2018 H. Wirtz <wirtz@parasitstudio.de>")); |
|
|
|
Serial.println(F("(c)2018 H. Wirtz <wirtz@parasitstudio.de>")); |
|
|
@ -208,6 +219,7 @@ void setup() |
|
|
|
Serial.print(1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES)); |
|
|
|
Serial.print(1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES)); |
|
|
|
Serial.println(F("ms)")); |
|
|
|
Serial.println(F("ms)")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Epiano
|
|
|
|
ep->setParameter(DECAY, 0.5); |
|
|
|
ep->setParameter(DECAY, 0.5); |
|
|
|
ep->setParameter(RELEASE, 0.5); |
|
|
|
ep->setParameter(RELEASE, 0.5); |
|
|
|
ep->setParameter(HARDNESS, 0.7); |
|
|
|
ep->setParameter(HARDNESS, 0.7); |
|
|
@ -217,14 +229,27 @@ void setup() |
|
|
|
ep->setParameter(STEREO, 0.7); |
|
|
|
ep->setParameter(STEREO, 0.7); |
|
|
|
ep->setParameter(OVERDRIVE, 0.3); |
|
|
|
ep->setParameter(OVERDRIVE, 0.3); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Reverb
|
|
|
|
freeverb_r.roomsize(0.2); |
|
|
|
freeverb_r.roomsize(0.2); |
|
|
|
freeverb_l.roomsize(0.2); |
|
|
|
freeverb_l.roomsize(0.2); |
|
|
|
freeverb_r.damping(0.5); |
|
|
|
freeverb_r.damping(0.5); |
|
|
|
freeverb_l.damping(0.5); |
|
|
|
freeverb_l.damping(0.5); |
|
|
|
mixer_r.gain(0, 0.7); |
|
|
|
reverb_mixer_r.gain(0, 1.0); |
|
|
|
mixer_l.gain(0, 0.7); |
|
|
|
reverb_mixer_l.gain(0, 1.0); |
|
|
|
mixer_r.gain(1, 0.3); |
|
|
|
reverb_mixer_r.gain(1, 0.0); |
|
|
|
mixer_l.gain(1, 0.3); |
|
|
|
reverb_mixer_l.gain(1, 0.0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Chorus
|
|
|
|
|
|
|
|
chorus_r.enable(); |
|
|
|
|
|
|
|
chorus_r.bypass(false); |
|
|
|
|
|
|
|
chorus_r.frequency(1.0f); |
|
|
|
|
|
|
|
chorus_r.mix(0.5f); |
|
|
|
|
|
|
|
chorus_r.intensity(0.5f); |
|
|
|
|
|
|
|
chorus_l.enable(); |
|
|
|
|
|
|
|
chorus_r.bypass(false); |
|
|
|
|
|
|
|
chorus_l.frequency(1.0f); |
|
|
|
|
|
|
|
chorus_l.mix(0.5f); |
|
|
|
|
|
|
|
chorus_l.intensity(0.5f); |
|
|
|
|
|
|
|
|
|
|
|
Serial.println(F("<setup end>")); |
|
|
|
Serial.println(F("<setup end>")); |
|
|
|
|
|
|
|
|
|
|
|