Several fixes for avoiding distortion.

pull/32/head
Holger Wirtz 5 years ago
parent 01b7ca3173
commit 414458bdf7
  1. 6
      MicroDexed.ino
  2. 9
      config.h
  3. 3
      dexed.cpp

@ -300,11 +300,11 @@ void setup()
#ifdef SGTL5000_AUDIO_ENHANCE #ifdef SGTL5000_AUDIO_ENHANCE
sgtl5000_1.audioPostProcessorEnable(); sgtl5000_1.audioPostProcessorEnable();
sgtl5000_1.enhanceBassEnable(); sgtl5000_1.enhanceBassEnable();
sgtl5000_1.enhanceBass(1.0, 1.0); // 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); // 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.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.surroundSoundEnable(); sgtl5000_1.surroundSoundEnable();
sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05); 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.autoVolumeEnable();
sgtl5000_1.autoVolumeControl(1, 1, 1, 0.9, 0.01, 0.05);
/* The cutoff frequency is specified as follows: /* The cutoff frequency is specified as follows:
value frequency value frequency
0 80Hz 0 80Hz

@ -80,7 +80,7 @@
//************************************************************************************************* //*************************************************************************************************
//* DEBUG OUTPUT SETTINGS //* DEBUG OUTPUT SETTINGS
//************************************************************************************************* //*************************************************************************************************
//#define DEBUG 1 #define DEBUG 1
#define SERIAL_SPEED 230400 #define SERIAL_SPEED 230400
#define SHOW_XRUN 1 #define SHOW_XRUN 1
#define SHOW_CPU_LOAD_MSEC 5000 #define SHOW_CPU_LOAD_MSEC 5000
@ -93,8 +93,8 @@
// CHORUS parameters // CHORUS parameters
#define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 20.0 ms delay buffer. #define MOD_DELAY_SAMPLE_BUFFER int32_t(TIME_MS2SAMPLES(20.0)) // 20.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_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT // MOD_LINKWITZ_RILEY_FILTER_OUTPUT MOD_BUTTERWORTH_FILTER_OUTPUT MOD_NO_FILTER_OUTPUT
#define MOD_FILTER_CUTOFF_HZ 15 #define MOD_FILTER_CUTOFF_HZ 2000
// FX-CHAIN ENABLE/DISABLE // FX-CHAIN ENABLE/DISABLE
#define USE_FX 1 #define USE_FX 1
#define SGTL5000_AUDIO_ENHANCE 1 #define SGTL5000_AUDIO_ENHANCE 1
@ -103,13 +103,11 @@
//* AUDIO SOFTWARE SETTINGS //* AUDIO SOFTWARE SETTINGS
//************************************************************************************************* //*************************************************************************************************
#ifndef TEENSY_AUDIO_BOARD #ifndef TEENSY_AUDIO_BOARD
#define REDUCE_LOUDNESS 0
#if AUDIO_BLOCK_SAMPLES == 64 #if AUDIO_BLOCK_SAMPLES == 64
#define AUDIO_MEM 512 #define AUDIO_MEM 512
#else #else
#define AUDIO_MEM 384 #define AUDIO_MEM 384
#endif #endif
#define REDUCE_LOUDNESS 0
#else // IF TEENSY_AUDIO_BOARD #else // IF TEENSY_AUDIO_BOARD
/* /*
13: 3.16 Volts p-p 13: 3.16 Volts p-p
@ -286,7 +284,6 @@
// Audio // Audio
#ifdef TGA_AUDIO_BOARD #ifdef TGA_AUDIO_BOARD
#define REDUCE_LOUDNESS 0
#endif #endif
// Some optimizations // Some optimizations

@ -147,7 +147,8 @@ void Dexed::getSamples(uint16_t n_samples, int16_t* buffer)
for (j = 0; j < _N_; ++j) for (j = 0; j < _N_; ++j)
{ {
sumbuf[i + j] += static_cast<float>(signed_saturate_rshift(audiobuf.get()[j] >> 4, 24, 9)) / 0x8000; //sumbuf[i + j] += static_cast<float>(signed_saturate_rshift(audiobuf.get()[j] >> 4, 24, 9)) / 0x8000;
sumbuf[i + j] += static_cast<float>(signed_saturate_rshift(audiobuf.get()[j] >> 5, 24, 9)) / 0x8000;
audiobuf.get()[j] = 0; audiobuf.get()[j] = 0;
} }
} }

Loading…
Cancel
Save