Removes feedback and delay-offset completely.

Added simple description how to test the hardware on Linux inside config.h
Compile time option for using an output filter (and which type and cutoff) added
inside config.h
dev
Holger Wirtz 5 years ago
parent d3c8990996
commit 650c10d914
  1. 99
      MicroMDAEPiano.ino
  2. 207
      UI.hpp
  3. 32
      config.h
  4. 12
      effect_modulated_delay.cpp
  5. 2
      effect_modulated_delay.h

@ -56,42 +56,43 @@ AudioAmplifier volume_l;
AudioAmplifier inverter; AudioAmplifier inverter;
AudioEffectModulatedDelay modchorus_r; AudioEffectModulatedDelay modchorus_r;
AudioEffectModulatedDelay modchorus_l; AudioEffectModulatedDelay modchorus_l;
AudioMixer4 modchorus_fbk_mixer_r; #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioMixer4 modchorus_fbk_mixer_l;
AudioFilterBiquad modchorus_filter_r; AudioFilterBiquad modchorus_filter_r;
AudioFilterBiquad modchorus_filter_l; AudioFilterBiquad modchorus_filter_l;
#endif
AudioSynthWaveform modulator; AudioSynthWaveform modulator;
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 patchCord2(queue_r, freeverb_r); AudioConnection patchCord2(queue_r, freeverb_r);
AudioConnection patchCord3(queue_l, freeverb_l); AudioConnection patchCord3(queue_l, freeverb_l);
AudioConnection patchCord4(queue_r, 0, modchorus_fbk_mixer_r, 0); AudioConnection patchCord4(queue_r, 0, modchorus_r, 0);
AudioConnection patchCord5(queue_l, 0, modchorus_fbk_mixer_l, 0); AudioConnection patchCord5(queue_l, 0, modchorus_l, 0);
AudioConnection patchCord6(modchorus_fbk_mixer_r, 0, modchorus_r, 0); AudioConnection patchCord6(modulator, 0, modchorus_r, 1);
AudioConnection patchCord7(modchorus_fbk_mixer_l, 0, modchorus_l, 0); AudioConnection patchCord7(modulator, inverter);
AudioConnection patchCord8(modchorus_r, 0, modchorus_fbk_mixer_r, 1); AudioConnection patchCord8(inverter, 0, modchorus_l, 1);
AudioConnection patchCord9(modchorus_l, 0, modchorus_fbk_mixer_l, 1); AudioConnection patchCord9(queue_r, 0, mixer_r, 0);
AudioConnection patchCord10(modulator, 0, modchorus_r, 1); AudioConnection patchCord10(queue_l, 0, mixer_l, 0);
AudioConnection patchCord11(modulator, inverter); #if MOD_FILTER_OUTPUT != MOD_NO_FILTER_OUTPUT
AudioConnection patchCord12(inverter, 0, modchorus_l, 1); AudioConnection patchCord11(modchorus_r, modchorus_filter_r);
AudioConnection patchCord13(queue_r, 0, mixer_r, 0); AudioConnection patchCord12(modchorus_l, modchorus_filter_l);
AudioConnection patchCord14(queue_l, 0, mixer_l, 0); AudioConnection patchCord13(modchorus_filter_r, 0, mixer_r, 2);
AudioConnection patchCord15(modchorus_r, modchorus_filter_r); AudioConnection patchCord14(modchorus_filter_l, 0, mixer_l, 2);
AudioConnection patchCord16(modchorus_l, modchorus_filter_l); #else
AudioConnection patchCord17(modchorus_filter_r, 0, mixer_r, 2); AudioConnection patchCord11(modchorus_r, mixer_r);
AudioConnection patchCord18(modchorus_filter_l, 0, mixer_l, 2); AudioConnection patchCord12(modchorus_l, mixer_l);
AudioConnection patchCord19(freeverb_r, 0, mixer_r, 1); #endif
AudioConnection patchCord20(freeverb_l, 0, mixer_l, 1); AudioConnection patchCord15(freeverb_r, 0, mixer_r, 1);
AudioConnection patchCord21(mixer_r, volume_r); AudioConnection patchCord16(freeverb_l, 0, mixer_l, 1);
AudioConnection patchCord22(mixer_l, volume_l); AudioConnection patchCord17(mixer_r, volume_r);
AudioConnection patchCord18(mixer_l, volume_l);
#ifdef USB_AUDIO #ifdef USB_AUDIO
AudioOutputUSB usb1; AudioOutputUSB usb1;
AudioConnection patchCord23(volume_r, 0, usb1, 0); AudioConnection patchCord19(volume_r, 0, usb1, 0);
AudioConnection patchCord24(volume_l, 0, usb1, 1); AudioConnection patchCord20(volume_l, 0, usb1, 1);
#endif #endif
AudioOutputI2S i2s1; AudioOutputI2S i2s1;
AudioConnection patchCord25(volume_r, 0, i2s1, 0); AudioConnection patchCord21(volume_r, 0, i2s1, 0);
AudioConnection patchCord26(volume_l, 0, i2s1, 1); AudioConnection patchCord22(volume_l, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; AudioControlSGTL5000 sgtl5000_1;
// Objects // Objects
@ -134,9 +135,7 @@ config_t configuration = {
ENC_REVERB_DAMPING_DEFAULT, // reverb_damping ENC_REVERB_DAMPING_DEFAULT, // reverb_damping
ENC_REVERB_LEVEL_DEFAULT, // reverb_level ENC_REVERB_LEVEL_DEFAULT, // reverb_level
ENC_CHORUS_FREQUENCY_DEFAULT, // chorus_frequency ENC_CHORUS_FREQUENCY_DEFAULT, // chorus_frequency
ENC_CHORUS_DELAY_DEFAULT, // chorus_delay
ENC_CHORUS_INTENSITY_DEFAULT, // chorus_intensity ENC_CHORUS_INTENSITY_DEFAULT, // chorus_intensity
ENC_CHORUS_FEEDBACK_DEFAULT, // chorus_feedback
ENC_CHORUS_WAVEFORM_DEFAULT, // chorus_waveform ENC_CHORUS_WAVEFORM_DEFAULT, // chorus_waveform
ENC_CHORUS_LEVEL_DEFAULT, // chorus_level ENC_CHORUS_LEVEL_DEFAULT, // chorus_level
ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level
@ -246,41 +245,21 @@ void setup()
modulator.phase(0); modulator.phase(0);
modulator.amplitude(0.0); modulator.amplitude(0.0);
modulator.offset(0.0); modulator.offset(0.0);
#ifdef DEBUG #if MOD_FILTER_OUTPUT == MOD_BUTTERWORTH_FILTER_OUTPUT
Serial.print(F("Modulated delay buffer: "));
Serial.print(SAMPLES2TIME_MS(MOD_DELAY_SAMPLE_BUFFER), 2);
Serial.print(F(" ms / "));
Serial.print(MOD_DELAY_SAMPLE_BUFFER, DEC);
Serial.println(F(" samples"));
Serial.print(F("Max delay time: "));
Serial.print(float(ENC_CHORUS_DELAY_MAX) / 10, 2);
Serial.print(F(" ms / "));
Serial.print(uint16_t(TIME_MS2SAMPLES(float(ENC_CHORUS_DELAY_MAX) / 10)), DEC);
Serial.println(F(" samples"));
Serial.print(F("Default delay time: "));
Serial.print(float(ENC_CHORUS_DELAY_DEFAULT) / 10, 2);
Serial.print(F(" ms / "));
Serial.print(uint16_t(TIME_MS2SAMPLES(float(ENC_CHORUS_DELAY_DEFAULT) / 10)), DEC);
Serial.println(F(" samples"));
#endif
modchorus_r.offset(TIME_MS2SAMPLES(float(ENC_CHORUS_DELAY_MAX) / 10));
modchorus_l.offset(TIME_MS2SAMPLES(float(ENC_CHORUS_DELAY_MAX) / 10));
// Butterworth filter, 12 db/octave // Butterworth filter, 12 db/octave
modchorus_filter_r.setLowpass(0, 6000, 0.707); modchorus_filter_r.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707);
modchorus_filter_l.setLowpass(0, 6000, 0.707); modchorus_filter_l.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.707);
#elif MOD_FILTER_OUTPUT == MOD_LINKWITZ_RILEY_FILTER_OUTPUT
// Linkwitz-Riley filter, 48 dB/octave // Linkwitz-Riley filter, 48 dB/octave
//modchorus_filter_r.setLowpass(0, 6000, 0.54); modchorus_filter_r.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54);
//modchorus_filter_r.setLowpass(1, 6000, 1.3); modchorus_filter_r.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3);
//modchorus_filter_r.setLowpass(2, 6000, 0.54); modchorus_filter_r.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54);
//modchorus_filter_r.setLowpass(3, 6000, 1.3); modchorus_filter_r.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3);
//modchorus_filter_l.setLowpass(0, 6000, 0.54); modchorus_filter_l.setLowpass(0, MOD_FILTER_CUTOFF_HZ, 0.54);
//modchorus_filter_l.setLowpass(1, 6000, 1.3); modchorus_filter_l.setLowpass(1, MOD_FILTER_CUTOFF_HZ, 1.3);
//modchorus_filter_l.setLowpass(2, 6000, 0.54); modchorus_filter_l.setLowpass(2, MOD_FILTER_CUTOFF_HZ, 0.54);
//modchorus_filter_l.setLowpass(3, 6000, 1.3); modchorus_filter_l.setLowpass(3, MOD_FILTER_CUTOFF_HZ, 1.3);
modchorus_fbk_mixer_r.gain(0, 1.0); #endif
modchorus_fbk_mixer_l.gain(0, 1.0);
modchorus_fbk_mixer_r.gain(1, 0.0);
modchorus_fbk_mixer_l.gain(1, 0.0);
// 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(VOL_MAIN, 0.5); mixer_r.gain(VOL_MAIN, 0.5);

207
UI.hpp

@ -28,16 +28,16 @@
const uint8_t MAX_VARIABLES = 5; ///< @note Default: 5 const uint8_t MAX_VARIABLES = 5; ///< @note Default: 5
/// Configures the number of available functions per line. /// Configures the number of available functions per line.
const uint8_t MAX_FUNCTIONS = 43; ///< @note Default: 8 const uint8_t MAX_FUNCTIONS = 41; ///< @note Default: 8
/// Configures the number of available lines per screen. /// Configures the number of available lines per screen.
const uint8_t MAX_LINES = 22; ///< @note Default: 12 const uint8_t MAX_LINES = 20; ///< @note Default: 12
/// Configures the number of available screens per menu. /// Configures the number of available screens per menu.
const uint8_t MAX_SCREENS = 2; ///< @note Default: 14 const uint8_t MAX_SCREENS = 2; ///< @note Default: 14
/// Configures the number of available menus per menus system. /// Configures the number of available menus per menus system.
const uint8_t MAX_MENUS = 46; ///< @note Default: 8 const uint8_t MAX_MENUS = 44; ///< @note Default: 8
*/ */
@ -56,7 +56,7 @@ int32_t encoder_value[NUM_ENCODER];
Bounce but[NUM_ENCODER] = {Bounce(BUT_L_PIN, BUT_DEBOUNCE_MS), Bounce(BUT_R_PIN, BUT_DEBOUNCE_MS)}; Bounce but[NUM_ENCODER] = {Bounce(BUT_L_PIN, BUT_DEBOUNCE_MS), Bounce(BUT_R_PIN, BUT_DEBOUNCE_MS)};
elapsedMillis back_to_main; elapsedMillis back_to_main;
#define NUM_MENUS 46 #define NUM_MENUS 44
#define MAIN 0 #define MAIN 0
/*************************************/ /*************************************/
@ -90,25 +90,23 @@ elapsedMillis back_to_main;
#define REV_DAMPING 26 #define REV_DAMPING 26
#define REV_LEVEL 27 #define REV_LEVEL 27
#define CHORUS_FREQ 28 #define CHORUS_FREQ 28
#define CHORUS_DELAY 29 #define CHORUS_INTENSITY 29
#define CHORUS_INTENSITY 30 #define CHORUS_WAVEFORM 30
#define CHORUS_FEEDBACK 31 #define CHORUS_LEVEL 31
#define CHORUS_WAVEFORM 32 #define BASS_LR_LEVEL 32
#define CHORUS_LEVEL 33 #define BASS_MONO_LEVEL 33
#define BASS_LR_LEVEL 34 #define EQ_BASS 34
#define BASS_MONO_LEVEL 35 #define EQ_TREBLE 35
#define EQ_BASS 36
#define EQ_TREBLE 37
/*************************************/ /*************************************/
#define LOUDNESS 38 #define LOUDNESS 36
#define MIDI_CHANNEL 39 #define MIDI_CHANNEL 37
#define MIDI_SOFT_THRU 40 #define MIDI_SOFT_THRU 38
#define MAX_POLY 41 #define MAX_POLY 39
#define MONO 42 #define MONO 40
/*************************************/ /*************************************/
#define STORE_QUESTION 43 #define STORE_QUESTION 41
/*************************************/ /*************************************/
#define MASTER_VOLUME 44 #define MASTER_VOLUME 42
/*************************************/ /*************************************/
int8_t menu_position[NUM_MENUS]; int8_t menu_position[NUM_MENUS];
@ -127,8 +125,6 @@ extern AudioEffectFreeverb freeverb_l;
extern AudioSynthWaveform modulator; extern AudioSynthWaveform modulator;
extern AudioEffectModulatedDelay modchorus_r; extern AudioEffectModulatedDelay modchorus_r;
extern AudioEffectModulatedDelay modchorus_l; extern AudioEffectModulatedDelay modchorus_l;
extern AudioMixer4 modchorus_fbk_mixer_r;
extern AudioMixer4 modchorus_fbk_mixer_l;
extern AudioMixer4 mixer_r; extern AudioMixer4 mixer_r;
extern AudioMixer4 mixer_l; extern AudioMixer4 mixer_l;
extern AudioAmplifier volume_r; extern AudioAmplifier volume_r;
@ -457,7 +453,7 @@ LiquidMenu velocity_sense_menu(lcd);
/****************************************** /******************************************
EFFECTS MENU EFFECTS MENU
******************************************/ ******************************************/
#define NUM_EFFECTS_MENUS 22 #define NUM_EFFECTS_MENUS 20
const char effects_text1[] PROGMEM = "Pan/Trem Freq."; const char effects_text1[] PROGMEM = "Pan/Trem Freq.";
const char effects_text2[] PROGMEM = "Pan/Trem Level"; const char effects_text2[] PROGMEM = "Pan/Trem Level";
const char effects_text3[] PROGMEM = "Overdrive"; const char effects_text3[] PROGMEM = "Overdrive";
@ -471,15 +467,13 @@ const char effects_text10[] PROGMEM = "Reverb Roomsize";
const char effects_text11[] PROGMEM = "Reverb Damping"; const char effects_text11[] PROGMEM = "Reverb Damping";
const char effects_text12[] PROGMEM = "Reverb Level"; const char effects_text12[] PROGMEM = "Reverb Level";
const char effects_text13[] PROGMEM = "Chorus Freq."; const char effects_text13[] PROGMEM = "Chorus Freq.";
const char effects_text14[] PROGMEM = "Chorus Delay"; const char effects_text14[] PROGMEM = "Chorus Intens.";
const char effects_text15[] PROGMEM = "Chorus Intens."; const char effects_text15[] PROGMEM = "Chorus Waveform";
const char effects_text16[] PROGMEM = "Chorus Feedback"; const char effects_text16[] PROGMEM = "Chorus Level";
const char effects_text17[] PROGMEM = "Chorus Waveform"; const char effects_text17[] PROGMEM = "Bass LR Level";
const char effects_text18[] PROGMEM = "Chorus Level"; const char effects_text18[] PROGMEM = "Bass M Level";
const char effects_text19[] PROGMEM = "Bass LR Level"; const char effects_text19[] PROGMEM = "EQ Bass";
const char effects_text20[] PROGMEM = "Bass M Level"; const char effects_text20[] PROGMEM = "EQ Treble";
const char effects_text21[] PROGMEM = "EQ Bass";
const char effects_text22[] PROGMEM = "EQ Treble";
LiquidLine effects_line1(1, 0, effects_text1); LiquidLine effects_line1(1, 0, effects_text1);
LiquidLine effects_line2(1, 1, effects_text2); LiquidLine effects_line2(1, 1, effects_text2);
LiquidLine effects_line3(1, 1, effects_text3); LiquidLine effects_line3(1, 1, effects_text3);
@ -500,8 +494,6 @@ LiquidLine effects_line17(1, 1, effects_text17);
LiquidLine effects_line18(1, 1, effects_text18); LiquidLine effects_line18(1, 1, effects_text18);
LiquidLine effects_line19(1, 1, effects_text19); LiquidLine effects_line19(1, 1, effects_text19);
LiquidLine effects_line20(1, 1, effects_text20); LiquidLine effects_line20(1, 1, effects_text20);
LiquidLine effects_line21(1, 1, effects_text21);
LiquidLine effects_line22(1, 1, effects_text22);
LiquidScreen effects_screen; LiquidScreen effects_screen;
LiquidMenu effects_menu(lcd); LiquidMenu effects_menu(lcd);
@ -637,16 +629,6 @@ LiquidLine chorus_frequency_line2(1, 1, get_chorus_frequency_value_text);
LiquidScreen chorus_frequency_screen; LiquidScreen chorus_frequency_screen;
LiquidMenu chorus_frequency_menu(lcd); LiquidMenu chorus_frequency_menu(lcd);
/******************************************
CHORUS_DELAY MENU
******************************************/
#define NUM_CHORUS_DELAY_MENUS 1
const char chorus_delay_text1[] PROGMEM = "Chorus Delay";
LiquidLine chorus_delay_line1(1, 0, chorus_delay_text1);
LiquidLine chorus_delay_line2(1, 1, get_chorus_delay_value_text);
LiquidScreen chorus_delay_screen;
LiquidMenu chorus_delay_menu(lcd);
/****************************************** /******************************************
CHORUS_INTENSITY MENU CHORUS_INTENSITY MENU
******************************************/ ******************************************/
@ -657,16 +639,6 @@ LiquidLine chorus_intensity_line2(1, 1, configuration.chorus_intensity);
LiquidScreen chorus_intensity_screen; LiquidScreen chorus_intensity_screen;
LiquidMenu chorus_intensity_menu(lcd); LiquidMenu chorus_intensity_menu(lcd);
/******************************************
CHORUS_FEEDBACK MENU
******************************************/
#define NUM_CHORUS_FEEDBACK_MENUS 1
const char chorus_feedback_text1[] PROGMEM = "Chorus Feedback";
LiquidLine chorus_feedback_line1(1, 0, chorus_feedback_text1);
LiquidLine chorus_feedback_line2(1, 1, configuration.chorus_feedback);
LiquidScreen chorus_feedback_screen;
LiquidMenu chorus_feedback_menu(lcd);
/****************************************** /******************************************
CHORUS_WAVEFORM MENU CHORUS_WAVEFORM MENU
******************************************/ ******************************************/
@ -1170,18 +1142,6 @@ void callback_chorus_frequency_function(void)
menu_system.update(); menu_system.update();
} }
void callback_chorus_delay_function(void)
{
#ifdef SHOW_DEBUG
Serial.println(F("callback_chorus_delay_function"));
#endif
menu_system.change_menu(chorus_delay_menu);
menu_position[EFFECTS] = encoder_value[RIGHT_ENCODER];
encoder_value[RIGHT_ENCODER] = configuration.chorus_delay;
enc[RIGHT_ENCODER].write(configuration.chorus_delay, ENC_CHORUS_DELAY_MIN, ENC_CHORUS_DELAY_MAX);
menu_system.update();
}
void callback_chorus_intensity_function(void) void callback_chorus_intensity_function(void)
{ {
#ifdef SHOW_DEBUG #ifdef SHOW_DEBUG
@ -1194,18 +1154,6 @@ void callback_chorus_intensity_function(void)
menu_system.update(); menu_system.update();
} }
void callback_chorus_feedback_function(void)
{
#ifdef SHOW_DEBUG
Serial.println(F("callback_chorus_feedback_function"));
#endif
menu_system.change_menu(chorus_feedback_menu);
menu_position[EFFECTS] = encoder_value[RIGHT_ENCODER];
encoder_value[RIGHT_ENCODER] = configuration.chorus_feedback;
enc[RIGHT_ENCODER].write(configuration.chorus_feedback, ENC_CHORUS_FEEDBACK_MIN, ENC_CHORUS_FEEDBACK_MAX);
menu_system.update();
}
void callback_chorus_waveform_function(void) void callback_chorus_waveform_function(void)
{ {
#ifdef SHOW_DEBUG #ifdef SHOW_DEBUG
@ -1615,8 +1563,6 @@ void init_menus(void)
effects_screen.add_line(effects_line18); effects_screen.add_line(effects_line18);
effects_screen.add_line(effects_line19); effects_screen.add_line(effects_line19);
effects_screen.add_line(effects_line20); effects_screen.add_line(effects_line20);
effects_screen.add_line(effects_line21);
effects_screen.add_line(effects_line22);
effects_screen.set_displayLineCount(2); effects_screen.set_displayLineCount(2);
effects_menu.add_screen(effects_screen); effects_menu.add_screen(effects_screen);
@ -1633,15 +1579,13 @@ void init_menus(void)
effects_line11.attach_function(REV_DAMPING, callback_reverb_damping_function); effects_line11.attach_function(REV_DAMPING, callback_reverb_damping_function);
effects_line12.attach_function(REV_LEVEL, callback_reverb_level_function); effects_line12.attach_function(REV_LEVEL, callback_reverb_level_function);
effects_line13.attach_function(CHORUS_FREQ, callback_chorus_frequency_function); effects_line13.attach_function(CHORUS_FREQ, callback_chorus_frequency_function);
effects_line14.attach_function(CHORUS_DELAY, callback_chorus_delay_function); effects_line14.attach_function(CHORUS_INTENSITY, callback_chorus_intensity_function);
effects_line15.attach_function(CHORUS_INTENSITY, callback_chorus_intensity_function); effects_line15.attach_function(CHORUS_WAVEFORM, callback_chorus_waveform_function);
effects_line16.attach_function(CHORUS_FEEDBACK, callback_chorus_feedback_function); effects_line16.attach_function(CHORUS_LEVEL, callback_chorus_level_function);
effects_line17.attach_function(CHORUS_WAVEFORM, callback_chorus_waveform_function); effects_line17.attach_function(BASS_LR_LEVEL, callback_bass_lr_level_function);
effects_line18.attach_function(CHORUS_LEVEL, callback_chorus_level_function); effects_line18.attach_function(BASS_MONO_LEVEL, callback_bass_mono_level_function);
effects_line19.attach_function(BASS_LR_LEVEL, callback_bass_lr_level_function); effects_line19.attach_function(EQ_BASS, callback_eq_bass_function);
effects_line20.attach_function(BASS_MONO_LEVEL, callback_bass_mono_level_function); effects_line20.attach_function(EQ_TREBLE, callback_eq_treble_function);
effects_line21.attach_function(EQ_BASS, callback_eq_bass_function);
effects_line22.attach_function(EQ_TREBLE, callback_eq_treble_function);
// setup pan_trem_frequency menu // setup pan_trem_frequency menu
pan_trem_frequency_screen.add_line(pan_trem_frequency_line1); pan_trem_frequency_screen.add_line(pan_trem_frequency_line1);
@ -1721,24 +1665,12 @@ void init_menus(void)
chorus_frequency_screen.set_displayLineCount(2); chorus_frequency_screen.set_displayLineCount(2);
chorus_frequency_menu.add_screen(chorus_frequency_screen); chorus_frequency_menu.add_screen(chorus_frequency_screen);
// setup chorus_delay menu
chorus_delay_screen.add_line(chorus_delay_line1);
chorus_delay_screen.add_line(chorus_delay_line2);
chorus_delay_screen.set_displayLineCount(2);
chorus_delay_menu.add_screen(chorus_delay_screen);
// setup chorus_intensity menu // setup chorus_intensity menu
chorus_intensity_screen.add_line(chorus_intensity_line1); chorus_intensity_screen.add_line(chorus_intensity_line1);
chorus_intensity_screen.add_line(chorus_intensity_line2); chorus_intensity_screen.add_line(chorus_intensity_line2);
chorus_intensity_screen.set_displayLineCount(2); chorus_intensity_screen.set_displayLineCount(2);
chorus_intensity_menu.add_screen(chorus_intensity_screen); chorus_intensity_menu.add_screen(chorus_intensity_screen);
// setup chorus_feedback menu
chorus_feedback_screen.add_line(chorus_feedback_line1);
chorus_feedback_screen.add_line(chorus_feedback_line2);
chorus_feedback_screen.set_displayLineCount(2);
chorus_feedback_menu.add_screen(chorus_feedback_screen);
// setup chorus_waveform menu // setup chorus_waveform menu
chorus_waveform_screen.add_line(chorus_waveform_line1); chorus_waveform_screen.add_line(chorus_waveform_line1);
chorus_waveform_screen.add_line(chorus_waveform_line2); chorus_waveform_screen.add_line(chorus_waveform_line2);
@ -1874,9 +1806,7 @@ void init_menus(void)
menu_system.add_menu(reverb_damping_menu); menu_system.add_menu(reverb_damping_menu);
menu_system.add_menu(reverb_level_menu); menu_system.add_menu(reverb_level_menu);
menu_system.add_menu(chorus_frequency_menu); menu_system.add_menu(chorus_frequency_menu);
menu_system.add_menu(chorus_delay_menu);
menu_system.add_menu(chorus_intensity_menu); menu_system.add_menu(chorus_intensity_menu);
menu_system.add_menu(chorus_feedback_menu);
menu_system.add_menu(chorus_waveform_menu); menu_system.add_menu(chorus_waveform_menu);
menu_system.add_menu(chorus_level_menu); menu_system.add_menu(chorus_level_menu);
menu_system.add_menu(bass_lr_level_menu); menu_system.add_menu(bass_lr_level_menu);
@ -2222,27 +2152,6 @@ void set_chorus_frequency(uint8_t value)
configuration.chorus_frequency = value; configuration.chorus_frequency = value;
} }
void set_chorus_delay(uint8_t value)
{
if (value > ENC_CHORUS_DELAY_MAX)
value = ENC_CHORUS_DELAY_MAX;
else if (value < ENC_CHORUS_DELAY_MIN)
value = ENC_CHORUS_DELAY_MIN;
#ifdef SHOW_DEBUG
Serial.print(F("Set CHORUS_DELAY "));
Serial.print(value);
Serial.print(F(" ("));
Serial.print(float(value) / 10);
Serial.print(F(" ms / "));
Serial.print(uint16_t(TIME_MS2SAMPLES(float(value) / 10)));
Serial.print(F(" samples)"));
Serial.println();
#endif
modchorus_r.offset(TIME_MS2SAMPLES(float(value) / 10));
modchorus_l.offset(TIME_MS2SAMPLES(float(value) / 10));
configuration.chorus_delay = value;
}
void set_chorus_intensity(uint8_t value) void set_chorus_intensity(uint8_t value)
{ {
if (value > ENC_CHORUS_INTENSITY_MAX) if (value > ENC_CHORUS_INTENSITY_MAX)
@ -2255,22 +2164,6 @@ void set_chorus_intensity(uint8_t value)
configuration.chorus_intensity = value; configuration.chorus_intensity = value;
} }
void set_chorus_feedback(uint8_t value)
{
if (value > ENC_CHORUS_FEEDBACK_MAX)
value = ENC_CHORUS_FEEDBACK_MAX;
#ifdef SHOW_DEBUG
Serial.print(F("Set CHORUS_FEEDBACK "));
Serial.println(value);
#endif
float tmp = mapfloat(float(value), ENC_CHORUS_FEEDBACK_MIN, ENC_CHORUS_FEEDBACK_MAX, 0.0, 0.5);
modchorus_fbk_mixer_r.gain(0, 1.0 - tmp);
modchorus_fbk_mixer_l.gain(0, 1.0 - tmp);
modchorus_fbk_mixer_r.gain(1, tmp);
modchorus_fbk_mixer_l.gain(1, tmp);
configuration.chorus_feedback = value;
}
void set_chorus_waveform(uint8_t value) void set_chorus_waveform(uint8_t value)
{ {
#ifdef SHOW_DEBUG #ifdef SHOW_DEBUG
@ -2457,9 +2350,7 @@ void set_complete_configuration(void)
set_reverb_damping(configuration.reverb_damping); set_reverb_damping(configuration.reverb_damping);
set_reverb_level(configuration.reverb_level); set_reverb_level(configuration.reverb_level);
set_chorus_frequency(configuration.chorus_frequency); set_chorus_frequency(configuration.chorus_frequency);
set_chorus_delay(configuration.chorus_delay);
set_chorus_intensity(configuration.chorus_intensity); set_chorus_intensity(configuration.chorus_intensity);
set_chorus_feedback(configuration.chorus_feedback);
set_chorus_waveform(configuration.chorus_waveform); set_chorus_waveform(configuration.chorus_waveform);
set_chorus_level(configuration.chorus_level); set_chorus_level(configuration.chorus_level);
set_bass_lr_level(configuration.bass_lr_level); set_bass_lr_level(configuration.bass_lr_level);
@ -2706,15 +2597,6 @@ void handle_ui(void)
menu_system.update(); menu_system.update();
} }
} }
else if (menu_system.get_currentScreen() == &chorus_delay_screen)
{
if (encoder_tmp != encoder_value[RIGHT_ENCODER])
{
// value up/down
set_chorus_delay(encoder_tmp);
menu_system.update();
}
}
else if (menu_system.get_currentScreen() == &chorus_intensity_screen) else if (menu_system.get_currentScreen() == &chorus_intensity_screen)
{ {
if (encoder_tmp != encoder_value[RIGHT_ENCODER]) if (encoder_tmp != encoder_value[RIGHT_ENCODER])
@ -2724,15 +2606,6 @@ void handle_ui(void)
menu_system.update(); menu_system.update();
} }
} }
else if (menu_system.get_currentScreen() == &chorus_feedback_screen)
{
if (encoder_tmp != encoder_value[RIGHT_ENCODER])
{
// value up/down
set_chorus_feedback(encoder_tmp);
menu_system.update();
}
}
else if (menu_system.get_currentScreen() == &chorus_waveform_screen) else if (menu_system.get_currentScreen() == &chorus_waveform_screen)
{ {
if (encoder_tmp != encoder_value[RIGHT_ENCODER]) if (encoder_tmp != encoder_value[RIGHT_ENCODER])
@ -3172,13 +3045,6 @@ void handle_ui(void)
#endif #endif
goto_effects_menu(CHORUS_FREQ); goto_effects_menu(CHORUS_FREQ);
} }
else if (menu_system.get_currentScreen() == &chorus_delay_screen) // chorus_delay menu
{
#ifdef SHOW_DEBUG
Serial.println(F("from chorus_delay to effects"));
#endif
goto_effects_menu(CHORUS_DELAY);
}
else if (menu_system.get_currentScreen() == &chorus_intensity_screen) // chorus_intensity menu else if (menu_system.get_currentScreen() == &chorus_intensity_screen) // chorus_intensity menu
{ {
#ifdef SHOW_DEBUG #ifdef SHOW_DEBUG
@ -3186,13 +3052,6 @@ void handle_ui(void)
#endif #endif
goto_effects_menu(CHORUS_INTENSITY); goto_effects_menu(CHORUS_INTENSITY);
} }
else if (menu_system.get_currentScreen() == &chorus_feedback_screen) // chorus_feedback menu
{
#ifdef SHOW_DEBUG
Serial.println(F("from chorus_feedback to effects"));
#endif
goto_effects_menu(CHORUS_FEEDBACK);
}
else if (menu_system.get_currentScreen() == &chorus_waveform_screen) // chorus_waveform menu else if (menu_system.get_currentScreen() == &chorus_waveform_screen) // chorus_waveform menu
{ {
#ifdef SHOW_DEBUG #ifdef SHOW_DEBUG

@ -30,8 +30,12 @@
// ATTENTION! For better latency you have to redefine AUDIO_BLOCK_SAMPLES from // ATTENTION! For better latency you have to redefine AUDIO_BLOCK_SAMPLES from
// 128 to 64 in <ARDUINO-IDE-DIR>/cores/teensy3/AudioStream.h // 128 to 64 in <ARDUINO-IDE-DIR>/cores/teensy3/AudioStream.h
// arecord -f cd -Dhw:1,0 /tmp/bla.wav // If you want to test the system with Linux and withous any keyboard and/or audio equipment, you can do the following:
// aplaymidi -p 20:0 test.mid // 1. In Arduino-IDE enable "Tools->USB-Type->Serial + MIDI + Audio"
// 2. Build the firmware with "MIDI_DEVICE_USB" enabled in config.h.
// 3. Afterconnecting to a Linux system there should be a MIDI an audio device available that is called "MicroMDAEPiano", so you can start the following:
// $ aplaymidi -p 20:0 <MIDI-File> # e.g. test.mid
// $ arecord -f cd -Dhw:1,0 /tmp/bla.wav
//************************************************************************************************* //*************************************************************************************************
//* DEVICE SETTINGS //* DEVICE SETTINGS
@ -58,12 +62,11 @@
#define REDUCE_LOUDNESS 0 #define REDUCE_LOUDNESS 0
#define USE_XFADE_DATA 1 #define USE_XFADE_DATA 1
/* HELPER MACROS */
#define TIME_MS2SAMPLES(x) floor(uint32_t(x) * AUDIO_SAMPLE_RATE / 1000)
#define SAMPLES2TIME_MS(x) float(uint32_t(x) * 1000 / AUDIO_SAMPLE_RATE)
// CHORUS parameters // CHORUS parameters
#define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(10.0)) #define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 10.0 ms delay buffer.
#define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE #define MOD_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINE WAVEFORM_TRIANGLE WAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE
#define MOD_FILTER_OUTPUT MOD_LINKWITZ_RILEY_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT
#define MOD_FILTER_CUTOFF_HZ 3000
//************************************************************************************************* //*************************************************************************************************
//* DEBUG OUTPUT SETTINGS //* DEBUG OUTPUT SETTINGS
@ -143,6 +146,13 @@
#define MICRO_MDAEPIANO_VERSION "0.9.9" #define MICRO_MDAEPIANO_VERSION "0.9.9"
/* HELPER MACROS */
#define TIME_MS2SAMPLES(x) floor(uint32_t(x) * AUDIO_SAMPLE_RATE / 1000)
#define SAMPLES2TIME_MS(x) float(uint32_t(x) * 1000 / AUDIO_SAMPLE_RATE)
#define MOD_NO_FILTER_OUTPUT 0
#define MOD_BUTTERWORTH_FILTER_OUTPUT 1
#define MOD_LINKWITZ_RILEY_FILTER_OUTPUT 2
#define MAX_SOUNDS min(99,int((4096-EEPROM_CONFIGURATIONS)/sizeof(config_t))) #define MAX_SOUNDS min(99,int((4096-EEPROM_CONFIGURATIONS)/sizeof(config_t)))
#define CONTROL_RATE_MS 100 #define CONTROL_RATE_MS 100
@ -237,21 +247,11 @@
#define ENC_CHORUS_FREQUENCY_MIN 0 #define ENC_CHORUS_FREQUENCY_MIN 0
#define ENC_CHORUS_FREQUENCY_MAX 200 #define ENC_CHORUS_FREQUENCY_MAX 200
#define ENC_CHORUS_FREQUENCY_DEFAULT 30 #define ENC_CHORUS_FREQUENCY_DEFAULT 30
//
#define ENC_CHORUS_DELAY_MIN uint8_t(SAMPLES2TIME_MS(MOD_DELAY_SAMPLE_BUFFER>>2)*10+0.5)
#define ENC_CHORUS_DELAY_MAX uint8_t(SAMPLES2TIME_MS(MOD_DELAY_SAMPLE_BUFFER>>2)*30+0.5)
//#define ENC_CHORUS_DELAY_DEFAULT uint8_t(SAMPLES2TIME_MS(MOD_DELAY_SAMPLE_BUFFER>>2)*20+0.5)
#define ENC_CHORUS_DELAY_DEFAULT 0
// //
#define ENC_CHORUS_INTENSITY_MIN 0 #define ENC_CHORUS_INTENSITY_MIN 0
#define ENC_CHORUS_INTENSITY_MAX 100 #define ENC_CHORUS_INTENSITY_MAX 100
#define ENC_CHORUS_INTENSITY_DEFAULT 50 #define ENC_CHORUS_INTENSITY_DEFAULT 50
// //
#define ENC_CHORUS_FEEDBACK_MIN 0
#define ENC_CHORUS_FEEDBACK_MAX 10
#define ENC_CHORUS_FEEDBACK_DEFAULT 0
//
#define ENC_CHORUS_WAVEFORM_MIN 1 #define ENC_CHORUS_WAVEFORM_MIN 1
#define ENC_CHORUS_WAVEFORM_MAX 2 #define ENC_CHORUS_WAVEFORM_MAX 2
#define ENC_CHORUS_WAVEFORM_DEFAULT 1 #define ENC_CHORUS_WAVEFORM_DEFAULT 1

@ -47,7 +47,6 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, uint16_t d_length)
_delayline = NULL; _delayline = NULL;
_delay_length = 0; _delay_length = 0;
_delay_offset = 0;
_cb_index = 0; _cb_index = 0;
if (delayline == NULL) { if (delayline == NULL) {
@ -64,13 +63,6 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, uint16_t d_length)
return (true); return (true);
} }
void AudioEffectModulatedDelay::offset(uint16_t offset_value) // in %
{
if (offset_value > 100)
offset_value = 100;
_delay_offset = floor(offset_value / 200.0 * _delay_length);
}
uint16_t AudioEffectModulatedDelay::get_delay_length(void) uint16_t AudioEffectModulatedDelay::get_delay_length(void)
{ {
return (_delay_length); return (_delay_length);
@ -109,11 +101,11 @@ void AudioEffectModulatedDelay::update(void)
_delayline[_cb_index] = *bp; _delayline[_cb_index] = *bp;
// calculate the modulation-index as a floating point number for interpolation // calculate the modulation-index as a floating point number for interpolation
mod_index = *mp * (_delay_length >> 2); mod_index = *mp * (_delay_length >> 1);
mod_fraction = modff(mod_index, &mod_number); // split float of mod_index into integer (= mod_number) and fraction part mod_fraction = modff(mod_index, &mod_number); // split float of mod_index into integer (= mod_number) and fraction part
// calculate modulation index into circular buffer // calculate modulation index into circular buffer
cb_mod_index = (_cb_index - (_delay_offset + mod_number)); cb_mod_index = _cb_index - mod_number;
if (cb_mod_index < 0) // check for negative offsets and correct them if (cb_mod_index < 0) // check for negative offsets and correct them
cb_mod_index += _delay_length; cb_mod_index += _delay_length;

@ -44,7 +44,6 @@ class AudioEffectModulatedDelay :
boolean begin(short *delayline, uint16_t delay_length); boolean begin(short *delayline, uint16_t delay_length);
virtual void update(void); virtual void update(void);
virtual void offset(uint16_t offset_value);
virtual uint16_t get_delay_length(void); virtual uint16_t get_delay_length(void);
private: private:
@ -52,7 +51,6 @@ class AudioEffectModulatedDelay :
audio_block_t *inputQueueArray[2]; audio_block_t *inputQueueArray[2];
int16_t *_delayline; // pointer for the circular buffer int16_t *_delayline; // pointer for the circular buffer
uint16_t _cb_index; // current write pointer of the circular buffer uint16_t _cb_index; // current write pointer of the circular buffer
uint16_t _delay_offset; // number of samples for the read offset of the modulation inside the circular buffer
uint16_t _delay_length; // calculated number of samples of the delay uint16_t _delay_length; // calculated number of samples of the delay
int16_t cb_mod_index; // current read pointer with modulation for the circular buffer int16_t cb_mod_index; // current read pointer with modulation for the circular buffer
}; };

Loading…
Cancel
Save