|
|
|
@ -28,6 +28,7 @@ |
|
|
|
|
#include <MIDI.h> |
|
|
|
|
#include <EEPROM.h> |
|
|
|
|
#include <limits.h> |
|
|
|
|
#include "mod-delay.h" |
|
|
|
|
#include "mdaEPiano.h" |
|
|
|
|
#ifdef USE_XFADE_DATA |
|
|
|
|
#include "mdaEPianoDataXfade.h" |
|
|
|
@ -45,7 +46,6 @@ |
|
|
|
|
#include "LiquidCrystalPlus_I2C.h" |
|
|
|
|
#include "UI.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*************************************************************************************************
|
|
|
|
|
//* GLOBAL VARIABLES
|
|
|
|
|
//*************************************************************************************************
|
|
|
|
@ -59,27 +59,37 @@ AudioEffectFreeverb freeverb_r; |
|
|
|
|
AudioEffectFreeverb freeverb_l; |
|
|
|
|
AudioMixer4 mixer_r; |
|
|
|
|
AudioMixer4 mixer_l; |
|
|
|
|
AudioSynthWaveform delaySweep_r; |
|
|
|
|
AudioSynthWaveform delaySweep_l; |
|
|
|
|
AudioEffectModDelay modulatedDelay_r; |
|
|
|
|
AudioEffectModDelay modulatedDelay_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 patchCord6(queue_r, modulatedDelay_r); |
|
|
|
|
AudioConnection patchCord7(queue_l, modulatedDelay_l); |
|
|
|
|
AudioConnection patchCord8(queue_r, 0, mixer_r, 0); |
|
|
|
|
AudioConnection patchCord9(queue_l, 0, mixer_l, 0); |
|
|
|
|
AudioConnection patchCord10(freeverb_r, 0, mixer_r, 1); |
|
|
|
|
AudioConnection patchCord11(freeverb_l, 0, mixer_l, 1); |
|
|
|
|
AudioConnection patchCord12(modulatedDelay_r, 0, mixer_r, 2); |
|
|
|
|
AudioConnection patchCord13(modulatedDelay_l, 0, mixer_l, 2); |
|
|
|
|
AudioConnection patchCord14(delaySweep_r, 0, modulatedDelay_r, 1); |
|
|
|
|
AudioConnection patchCord15(delaySweep_l, 0, modulatedDelay_l, 1); |
|
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
|
AudioOutputI2S i2s1; |
|
|
|
|
AudioConnection patchCord110(mixer_r, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord111(mixer_l, 0, i2s1, 1); |
|
|
|
|
AudioConnection patchCord18(mixer_r, 0, i2s1, 0); |
|
|
|
|
AudioConnection patchCord19(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 patchCord18(mixer_r, volume_r); |
|
|
|
|
AudioConnection patchCord19(mixer_l, volume_l); |
|
|
|
|
AudioConnection patchCord20(volume_r, 0, pt8211_1, 1); |
|
|
|
|
AudioConnection patchCord21(volume_l, 0, pt8211_1, 0); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Objects
|
|
|
|
@ -114,8 +124,12 @@ const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLE |
|
|
|
|
elapsedMillis cpu_mem_millis; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
enum MDA_EP_PARAM { DECAY, RELEASE, HARDNESS, TREBLE, PAN_TREM, LFO_RATE, VELOCITY_SENSE, STEREO, MAX_POLY, TUNE, DETUNE, OVERDRIVE }; |
|
|
|
|
const int32_t delayBufferLength = 1000; |
|
|
|
|
int16_t delayBuf_r[delayBufferLength]; |
|
|
|
|
int16_t delayBuf_l[delayBufferLength]; |
|
|
|
|
float modFreq = 0.7; |
|
|
|
|
|
|
|
|
|
enum MDA_EP_PARAM { DECAY, RELEASE, HARDNESS, TREBLE, PAN_TREM, LFO_RATE, VELOCITY_SENSE, STEREO, MAX_POLY, TUNE, DETUNE, OVERDRIVE }; |
|
|
|
|
|
|
|
|
|
//*************************************************************************************************
|
|
|
|
|
//* SETUP FUNCTION
|
|
|
|
@ -127,26 +141,26 @@ void setup() |
|
|
|
|
Serial.begin(SERIAL_SPEED); |
|
|
|
|
delay(220); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// LCD display setup
|
|
|
|
|
lcd.init(); |
|
|
|
|
lcd.blink_off(); |
|
|
|
|
lcd.cursor_off(); |
|
|
|
|
lcd.backlight(); |
|
|
|
|
lcd.noAutoscroll(); |
|
|
|
|
lcd.clear(); |
|
|
|
|
lcd.display(); |
|
|
|
|
lcd.show(0, 0, 20, " MicroMDAEPiano"); |
|
|
|
|
lcd.show(1, 0, 16, "(c)parasiTstudio"); |
|
|
|
|
|
|
|
|
|
// Encoder setup
|
|
|
|
|
enc[0].write(INITIAL_ENC_L_VALUE); |
|
|
|
|
enc_val[0] = enc[0].read(); |
|
|
|
|
enc[1].write(INITIAL_ENC_R_VALUE); |
|
|
|
|
enc_val[1] = enc[1].read(); |
|
|
|
|
but[0].update(); |
|
|
|
|
but[1].update(); |
|
|
|
|
*/ |
|
|
|
|
/*
|
|
|
|
|
// LCD display setup
|
|
|
|
|
lcd.init(); |
|
|
|
|
lcd.blink_off(); |
|
|
|
|
lcd.cursor_off(); |
|
|
|
|
lcd.backlight(); |
|
|
|
|
lcd.noAutoscroll(); |
|
|
|
|
lcd.clear(); |
|
|
|
|
lcd.display(); |
|
|
|
|
lcd.show(0, 0, 20, " MicroMDAEPiano"); |
|
|
|
|
lcd.show(1, 0, 16, "(c)parasiTstudio"); |
|
|
|
|
|
|
|
|
|
// Encoder setup
|
|
|
|
|
enc[0].write(INITIAL_ENC_L_VALUE); |
|
|
|
|
enc_val[0] = enc[0].read(); |
|
|
|
|
enc[1].write(INITIAL_ENC_R_VALUE); |
|
|
|
|
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")); |
|
|
|
@ -183,6 +197,8 @@ void setup() |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// start audio card
|
|
|
|
|
AudioNoInterrupts(); |
|
|
|
|
|
|
|
|
|
AudioMemory(AUDIO_MEM); |
|
|
|
|
|
|
|
|
|
#ifdef TEENSY_AUDIO_BOARD |
|
|
|
@ -223,10 +239,21 @@ void setup() |
|
|
|
|
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); |
|
|
|
|
|
|
|
|
|
modulatedDelay_r.setbuf(delayBufferLength, delayBuf_r); |
|
|
|
|
modulatedDelay_l.setbuf(delayBufferLength, delayBuf_l); |
|
|
|
|
delaySweep_r.begin(0.1, modFreq, WAVEFORM_SINE); |
|
|
|
|
delaySweep_l.begin(0.1, modFreq, WAVEFORM_SINE); |
|
|
|
|
//delaySweep_l.phase(180.0);
|
|
|
|
|
|
|
|
|
|
mixer_r.gain(0, 0.5); |
|
|
|
|
mixer_l.gain(0, 0.5); |
|
|
|
|
mixer_r.gain(1, 0.2); |
|
|
|
|
mixer_l.gain(1, 0.2); |
|
|
|
|
mixer_r.gain(2, 0.5); |
|
|
|
|
mixer_l.gain(2, 0.5); |
|
|
|
|
|
|
|
|
|
AudioInterrupts(); |
|
|
|
|
|
|
|
|
|
Serial.println(F("<setup end>")); |
|
|
|
|
|
|
|
|
|