From 61eebb12720295798298924c37278ef6bba3dd44 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 14 Jul 2021 11:01:24 +0200 Subject: [PATCH] Fixed T_3.6 config. I had to go down to single engine with 8 voices (and FX) or 16 voices (without FX). --- MicroDexed.ino | 40 ++++++++++++++++------------------------ config.h | 32 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index c91f9b1..2c44451 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -45,7 +45,7 @@ // Audio engines AudioSynthDexed* MicroDexed[NUM_DEXED]; -AudioEffectDynamics* compressor[NUM_DEXED]; +AudioEffectDynamics* dynamics[NUM_DEXED]; #if defined(USE_FX) AudioSynthWaveform* chorus_modulator[NUM_DEXED]; @@ -59,8 +59,6 @@ AudioEffectDelay* delay_fx[NUM_DEXED]; AudioMixer4* delay_mixer[NUM_DEXED]; #endif AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; -AudioEffectDynamics limiter_r; -AudioEffectDynamics limiter_l; AudioMixer4 microdexed_peak_mixer; AudioAnalyzePeak microdexed_peak; @@ -157,16 +155,12 @@ AudioConnection patchCord18(stereo2mono, 1, usb1, 1); #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) AudioInputI2S i2s1in; -//AudioConnection patchCord19(stereo2mono, 0, audio_thru_mixer_r, 0); -//AudioConnection patchCord20(stereo2mono, 1, audio_thru_mixer_l, 0); -AudioConnection patchCord19(stereo2mono, 0, limiter_r, 0); -AudioConnection patchCord20(stereo2mono, 1, limiter_l, 0); -AudioConnection patchCord21(limiter_r, 0, audio_thru_mixer_r, 0); -AudioConnection patchCord22(limiter_l, 0, audio_thru_mixer_l, 0); -AudioConnection patchCord23(i2s1in, 0, audio_thru_mixer_r, 1); -AudioConnection patchCord24(i2s1in, 1, audio_thru_mixer_l, 1); -AudioConnection patchCord25(audio_thru_mixer_r, 0, i2s1, 0); -AudioConnection patchCord26(audio_thru_mixer_l, 0, i2s1, 1); +AudioConnection patchCord19(stereo2mono, 0, audio_thru_mixer_r, 0); +AudioConnection patchCord20(stereo2mono, 1, audio_thru_mixer_l, 0); +AudioConnection patchCord21(i2s1in, 0, audio_thru_mixer_r, 1); +AudioConnection patchCord22(i2s1in, 1, audio_thru_mixer_l, 1); +AudioConnection patchCord23(audio_thru_mixer_r, 0, i2s1, 0); +AudioConnection patchCord24(audio_thru_mixer_l, 0, i2s1, 1); #endif // @@ -183,7 +177,7 @@ AudioConnection * dynamicConnections[NUM_DEXED * 5]; void create_audio_engine_chain(uint8_t instance_id) { MicroDexed[instance_id] = new AudioSynthDexed(MAX_NOTES / NUM_DEXED, SAMPLE_RATE); - compressor[instance_id] = new AudioEffectDynamics(); + dynamics[instance_id] = new AudioEffectDynamics(); mono2stereo[instance_id] = new AudioEffectMonoStereo(); #if defined(USE_FX) chorus_modulator[instance_id] = new AudioSynthWaveform(); @@ -197,8 +191,8 @@ void create_audio_engine_chain(uint8_t instance_id) delay_mixer[instance_id] = new AudioMixer4(); #endif - dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *compressor[instance_id], 0); - dynamicConnections[nDynamic++] = new AudioConnection(*compressor[instance_id], 0, microdexed_peak_mixer, instance_id); + dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *dynamics[instance_id], 0); + dynamicConnections[nDynamic++] = new AudioConnection(*dynamics[instance_id], 0, microdexed_peak_mixer, instance_id); #if defined(USE_FX) dynamicConnections[nDynamic++] = new AudioConnection(*MicroDexed[instance_id], 0, *chorus_mixer[instance_id], 0); @@ -525,11 +519,6 @@ void setup() audio_thru_mixer_l.gain(3, 0.0); #endif -#if defined(LIMIT_THRESHOLD) - limiter_r.limit(LIMIT_THRESHOLD, LIMIT_ATTACK, LIMIT_RELEASE); - limiter_l.limit(LIMIT_THRESHOLD, LIMIT_ATTACK, LIMIT_RELEASE); -#endif - #ifdef DEBUG Serial.println(F("")); #endif @@ -1886,10 +1875,13 @@ void set_fx_params(void) #if defined(USE_FX) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { - // COMPRESSOR THRESHOLD,ATTACK,RELEASE,RATIO,KNEE_WIDTH + // COMPRESSOR +#if defined(LIMIT_THRESHOLD) + dynamics[instance_id]->limit(LIMIT_THRESHOLD, LIMIT_ATTACK, LIMIT_RELEASE); +#endif #if defined(COMP_THRESHOLD) - compressor[instance_id]->compression(COMP_THRESHOLD, COMP_ATTACK, COMP_RELEASE, COMP_RATIO, COMP_KNEE_WIDTH); - compressor[instance_id]->makeupGain(COMP_MAKEUPGAIN); + dynamics[instance_id]->compression(COMP_THRESHOLD, COMP_ATTACK, COMP_RELEASE, COMP_RATIO, COMP_KNEE_WIDTH); + dynamics[instance_id]->makeupGain(COMP_MAKEUPGAIN); #endif // CHORUS diff --git a/config.h b/config.h index 747927d..33ada28 100644 --- a/config.h +++ b/config.h @@ -99,9 +99,15 @@ //* DEXED AND EFFECTS SETTINGS //************************************************************************************************* // Number of Dexed instances +#if defined(TEENSY3_6) +#define NUM_DEXED 1 // 1 or 2 - nothing else! +#else #define NUM_DEXED 2 // 1 or 2 - nothing else! +#endif + // FX-CHAIN ENABLE/DISABLE #define USE_FX 1 + // COMPRESSOR/ LIMITER #define COMP_THRESHOLD -20.0 #define COMP_ATTACK 0.2 @@ -109,9 +115,9 @@ #define COMP_RATIO 2.0 #define COMP_KNEE_WIDTH 1.0 #define COMP_MAKEUPGAIN 1.0 -#define LIMIT_THRESHOLD -3.0 +#define LIMIT_THRESHOLD -1.0 #define LIMIT_ATTACK 0.03 -#define LIMIT_RELEASE 0.7 +#define LIMIT_RELEASE 0.2 // CHORUS parameters #define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 20.0 ms delay buffer. @@ -312,33 +318,27 @@ // Teensy-3.6 settings #if defined(TEENSY3_6) # if defined(USE_FX) +# warning >>> With enabled FX only maximum of 8 voices is possible +# define MAX_NOTES 8 +# else # if F_CPU == 256000000 +# warning >>> Maximum of 16 voices. # define MAX_NOTES 16 # elif F_CPU == 240000000 +# warning >>> Maximum of 14 voices. You should consider to use 256MHz overclocking to get a maximum of 16 voices # define MAX_NOTES 14 # elif F_CPU == 216000000 +# warning >>> Maximum of 12 voices. You should consider to use 256MHz overclocking to get a maximum of 16 voices # define MAX_NOTES 12 # else -# warning >>> You should consider to use 256MHz overclocking to get polyphony of 16 voices <<< +# warning >>> Maximum of 10 voices. You should consider to use 256MHz overclocking to get a maximum of 16 voices # define MAX_NOTES 10 # endif -# else -# if F_CPU == 256000000 -# define MAX_NOTES 18 -# elif F_CPU == 240000000 -# define MAX_NOTES 16 -# elif F_CPU == 216000000 -# define MAX_NOTES 15 -# else -# define MAX_NOTES 12 -# endif # endif #endif #ifdef TEENSY3_5 -#undef MIDI_DEVICE_USB_HOST -#define MAX_NOTES 11 -#undef USE_FX +#error >>> Not supported anymore!!! #endif // MIDI