From c8a2fdbccc15495a4fcdc22fe40f0eceda261f43 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 30 Jul 2020 09:52:11 +0200 Subject: [PATCH] Fixes: Disabling audio thru by default because it's noisy. --- MicroDexed.ino | 92 ++++++++++++++++++++++++++++---------------------- config.h | 4 ++- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 62166ce..d25539b 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -73,6 +73,10 @@ AudioAmplifier volume_l; AudioEffectStereoMono stereo2mono; AudioAnalyzePeak master_peak_r; AudioAnalyzePeak master_peak_l; +#if defined(ANTIALIAS_FRQ) +AudioFilterBiquad antialias_r; +AudioFilterBiquad antialias_l; +#endif #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) AudioMixer4 audio_thru_mixer_r; AudioMixer4 audio_thru_mixer_l; @@ -92,59 +96,66 @@ AudioConnection patchCord2(freeverb_r, 0, master_mixer_r, 3); AudioConnection patchCord3(freeverb_l, 0, master_mixer_l, 3); #endif #endif +#if defined(ANTIALIAS_FRQ) +AudioConnection patchCord6(master_mixer_r, antialias_r); +AudioConnection patchCord7(master_mixer_l, antialias_l); +AudioConnection patchCord8(antialias_r, volume_r); +AudioConnection patchCord9(antialias_l, volume_l); +#else AudioConnection patchCord6(master_mixer_r, volume_r); AudioConnection patchCord7(master_mixer_l, volume_l); -AudioConnection patchCord8(volume_r, 0, stereo2mono, 0); -AudioConnection patchCord9(volume_l, 0, stereo2mono, 1); -AudioConnection patchCord10(stereo2mono, 0, master_peak_r, 0); -AudioConnection patchCord11(stereo2mono, 0, master_peak_l, 0); +#endif +AudioConnection patchCord10(volume_r, 0, stereo2mono, 0); +AudioConnection patchCord11(volume_l, 0, stereo2mono, 1); +AudioConnection patchCord12(stereo2mono, 0, master_peak_r, 0); +AudioConnection patchCord13(stereo2mono, 0, master_peak_l, 0); // Outputs #if defined(TEENSY_AUDIO_BOARD) AudioOutputI2S i2s1; #ifndef SGTL5000_AUDIO_THRU -AudioConnection patchCord12(stereo2mono, 0, i2s1, 0); -AudioConnection patchCord13(stereo2mono, 1, i2s1, 1); +AudioConnection patchCord14(stereo2mono, 0, i2s1, 0); +AudioConnection patchCord15(stereo2mono, 1, i2s1, 1); #endif AudioControlSGTL5000 sgtl5000_1; #elif defined (I2S_AUDIO_ONLY) AudioOutputI2S i2s1; -AudioConnection patchCord12(stereo2mono, 0, i2s1, 0); -AudioConnection patchCord13(stereo2mono, 1, i2s1, 1); +AudioConnection patchCord14(stereo2mono, 0, i2s1, 0); +AudioConnection patchCord15(stereo2mono, 1, i2s1, 1); #elif defined(TGA_AUDIO_BOARD) AudioOutputI2S i2s1; -AudioConnection patchCord12(stereo2mono, 0, i2s1, 0); -AudioConnection patchCord13(stereo2mono, 1, i2s1, 1); +AudioConnection patchCord14(stereo2mono, 0, i2s1, 0); +AudioConnection patchCord15(stereo2mono, 1, i2s1, 1); AudioControlWM8731master wm8731_1; #elif defined(PT8211_AUDIO) AudioOutputPT8211 pt8211_1; -AudioConnection patchCord12(stereo2mono, 0, pt8211_1, 0); -AudioConnection patchCord13(stereo2mono, 1, pt8211_1, 1); +AudioConnection patchCord14(stereo2mono, 0, pt8211_1, 0); +AudioConnection patchCord15(stereo2mono, 1, pt8211_1, 1); #elif defined(TEENSY_DAC_SYMMETRIC) AudioOutputAnalogStereo dacOut; AudioMixer4 invMixer; -AudioConnection patchCord12(stereo2mono, 0, dacOut , 0); -AudioConnection patchCord13(stereo2mono, 1, invMixer, 0); -AudioConnection patchCord14(invMixer, 0, dacOut , 1); +AudioConnection patchCord14(stereo2mono, 0, dacOut , 0); +AudioConnection patchCord15(stereo2mono, 1, invMixer, 0); +AudioConnection patchCord16(invMixer, 0, dacOut , 1); #elif defined(TEENSY_DAC) AudioOutputAnalogStereo dacOut; -AudioConnection patchCord12(stereo2mono, 0, dacOut, 0); -AudioConnection patchCord13(stereo2mono, 1, dacOut, 1); +AudioConnection patchCord14(stereo2mono, 0, dacOut, 0); +AudioConnection patchCord15(stereo2mono, 1, dacOut, 1); #endif #ifdef AUDIO_DEVICE_USB AudioOutputUSB usb1; -AudioConnection patchCord15(stereo2mono, 0, usb1, 0); -AudioConnection patchCord16(stereo2mono, 1, usb1, 1); +AudioConnection patchCord17(stereo2mono, 0, usb1, 0); +AudioConnection patchCord18(stereo2mono, 1, usb1, 1); #endif #if defined(TEENSY_AUDIO_BOARD) && defined(SGTL5000_AUDIO_THRU) AudioInputI2S i2s1in; -AudioConnection patchCord17(stereo2mono, 0, audio_thru_mixer_r, 0); -AudioConnection patchCord18(stereo2mono, 1, audio_thru_mixer_l, 0); -AudioConnection patchCord19(i2s1in, 0, audio_thru_mixer_r, 1); -AudioConnection patchCord20(i2s1in, 1, audio_thru_mixer_l, 1); -AudioConnection patchCord21(audio_thru_mixer_r, 0, i2s1, 0); -AudioConnection patchCord22(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 // @@ -309,34 +320,24 @@ void setup() sgtl5000_1.unmuteHeadphone(); sgtl5000_1.unmuteLineout(); sgtl5000_1.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume - sgtl5000_1.audioProcessorDisable(); - sgtl5000_1.audioPostProcessorEnable(); #ifdef SGTL5000_AUDIO_THRU - sgtl5000_1.audioPreProcessorEnable(); + //sgtl5000_1.audioPreProcessorEnable(); sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN); sgtl5000_1.lineInLevel(5); - sgtl5000_1.adcHighPassFilterEnable(); + //sgtl5000_1.adcHighPassFilterEnable(); #endif #ifdef SGTL5000_AUDIO_ENHANCE + sgtl5000_1.audioPostProcessorEnable(); sgtl5000_1.enhanceBassEnable(); - sgtl5000_1.enhanceBass(1.0, 1.5); // enhanceBass(1.0, 1.0, 1, 2); // Configures the bass enhancement by setting the levels of the original stereo signal and the bass-enhanced mono level which will be mixed together. The high-pass filter may be enabled (0) or bypassed (1). + sgtl5000_1.enhanceBass(1.0, 1.5, 0, 5); // enhanceBass(1.0, 1.0, 1, 2); // Configures the bass enhancement by setting the levels of the original stereo signal and the bass-enhanced mono level which will be mixed together. The high-pass filter may be enabled (0) or bypassed (1). sgtl5000_1.surroundSoundEnable(); sgtl5000_1.surroundSound(7, 3); // Configures virtual surround width from 0 (mono) to 7 (widest). select may be set to 1 (disable), 2 (mono input) or 3 (stereo input). sgtl5000_1.autoVolumeEnable(); sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05); - /* The cutoff frequency is specified as follows: - value frequency - 0 80Hz - 1 100Hz - 2 125Hz - 3 150Hz - 4 175Hz - 5 200Hz - 6 225Hz - */ sgtl5000_1.eqSelect(2); // Tone Control sgtl5000_1.eqBands(EQ_BASS_DEFAULT, EQ_TREBLE_DEFAULT); #else + sgtl5000_1.audioProcessorDisable(); sgtl5000_1.autoVolumeDisable(); sgtl5000_1.surroundSoundDisable(); sgtl5000_1.enhanceBassDisable(); @@ -412,6 +413,17 @@ void setup() freeverb_antialias_l.setLowpass(3, REVERB_ANTIALIAS_FRQ, 1.3); #endif +#if defined(ANTIALIAS_FRQ) + antialias_r.setLowpass(0, ANTIALIAS_FRQ, 0.54); + antialias_r.setLowpass(1, ANTIALIAS_FRQ, 1.3); + antialias_r.setLowpass(2, ANTIALIAS_FRQ, 0.54); + antialias_r.setLowpass(3, ANTIALIAS_FRQ, 1.3); + antialias_l.setLowpass(0, ANTIALIAS_FRQ, 0.54); + antialias_l.setLowpass(1, ANTIALIAS_FRQ, 1.3); + antialias_l.setLowpass(2, ANTIALIAS_FRQ, 0.54); + antialias_l.setLowpass(3, ANTIALIAS_FRQ, 1.3); +#endif + initial_values_from_eeprom(false); // start SD card diff --git a/config.h b/config.h index 28aeb10..489880d 100644 --- a/config.h +++ b/config.h @@ -103,7 +103,7 @@ #define DEXED_ENGINE DEXED_ENGINE_MODERN // DEXED_ENGINE_MARKI // DEXED_ENGINE_OPL // Number of Dexed instances -#define NUM_DEXED 1 // 1 or 2 - nothing else! +#define NUM_DEXED 2 // 1 or 2 - nothing else! // FX-CHAIN ENABLE/DISABLE #define USE_FX 1 // CHORUS parameters @@ -113,6 +113,8 @@ #define MOD_FILTER_CUTOFF_HZ 2000 // REVERB parameters #define REVERB_ANTIALIAS_FRQ 7500 +// ANTIALIAS frequency +//#define ANTIALIAS_FRQ 15000 // SGTL5000 #ifdef TEENSY_AUDIO_BOARD #define SGTL5000_AUDIO_ENHANCE 1