From a48f99623261be69a6d87f6b0043d296256ddc91 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 3 Jun 2019 15:14:28 +0200 Subject: [PATCH] Several small fixes. --- MicroMDAEPiano.ino | 17 ++++++++++------- config.h | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/MicroMDAEPiano.ino b/MicroMDAEPiano.ino index 8fde271..5c4994d 100644 --- a/MicroMDAEPiano.ino +++ b/MicroMDAEPiano.ino @@ -130,7 +130,7 @@ config_t configuration = { ENC_REVERB_LEVEL_DEFAULT, // reverb_level 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_LEVEL_DEFAULT, // chorus_level ENC_BASS_LR_LEVEL_DEFAULT, // bass_lr_level ENC_BASS_MONO_LEVEL_DEFAULT, // bass_mono_level @@ -153,8 +153,6 @@ elapsedMillis eeprom_master_volume_update_timer; elapsedMillis cpu_mem_millis; #endif -// Number of samples in each delay line -#define CHORUS_DELAY_LENGTH (16*AUDIO_BLOCK_SAMPLES) // Allocate the delay lines for left and right channels short l_delayline[CHORUS_DELAY_LENGTH]; short r_delayline[CHORUS_DELAY_LENGTH]; @@ -215,8 +213,13 @@ void setup() Serial.println(F("PT8211 enabled.")); #endif + // set master volume set_master_volume(master_volume); - + + // internal mixing of original signal(0), reverb(1) and chorus(2) + mixer_r.gain(0, 1.0); + mixer_l.gain(0, 1.0); + #if defined (DEBUG) && defined (SHOW_CPU_LOAD_MSEC) // Initialize processor and memory measurements AudioProcessorUsageMaxReset(); @@ -241,7 +244,7 @@ void setup() // chorus modulation fixed memset(r_delayline, 0, sizeof(short)*CHORUS_DELAY_LENGTH); memset(l_delayline, 0, sizeof(short)*CHORUS_DELAY_LENGTH); - modulator.begin(WAVEFORM_TRIANGLE); + modulator.begin(CHORUS_WAVEFORM); modulator.amplitude(0.1); modulator.frequency(1.0); modulator.phase(0); @@ -508,8 +511,8 @@ void set_master_volume(uint8_t value) // float v = (float)(a * (a + 2))/(float)(1 << 20); // (pseudo-) logarithmic curve for volume control // http://files.csound-tutorial.net/floss_manual/Release03/Cs_FM_03_ScrapBook/b-panning-and-spatialization.html - mixer_r.gain(0, tmp3 * sinf(tmp2 * PI / 2)); - mixer_l.gain(0, tmp3 * cosf(tmp2 * PI / 2)); + volume_r.gain(tmp3 * sinf(tmp2 * PI / 2)); + volume_l.gain(tmp3 * cosf(tmp2 * PI / 2)); eeprom_master_volume_update_flag = true; eeprom_master_volume_update_timer = 0; diff --git a/config.h b/config.h index 68651e2..3512b8e 100644 --- a/config.h +++ b/config.h @@ -56,13 +56,15 @@ //************************************************************************************************* #define VOLUME 0.8 -#define VOLUME_CURVE 0.07 #define AUDIO_MEM 128 -#define SAMPLE_RATE 44100 +#define SAMPLE_RATE AUDIO_SAMPLE_RATE #define REDUCE_LOUDNESS 0 #define USE_XFADE_DATA 1 -#define INTERPOLATION_WINDOW_SIZE 7 // For chorus, only odd numbers! +// CHORUS parameters +#define INTERPOLATION_WINDOW_SIZE 7 // For chorus, only odd numbers,please! #define INTERPOLATE CUBIC // LINEAR COSINE LAGRANGE QUADRATIC +#define CHORUS_WAVEFORM WAVEFORM_TRIANGLE // WAVEFORM_SINEWAVEFORM_SAWTOOTH WAVEFORM_SAWTOOTH_REVERSE WAVEFORM_SQUARE WAVEFORM_TRIANGLE +#define CHORUS_DELAY_LENGTH (16*AUDIO_BLOCK_SAMPLES) //************************************************************************************************* //* DEBUG OUTPUT SETTINGS @@ -137,7 +139,7 @@ //* DO NO CHANGE ANYTHING BEYOND IF YOU DON'T KNOW WHAT YOU ARE DOING !!! //************************************************************************************************* -#define MICRO_MDAEPIANO_VERSION "0.9.1" +#define MICRO_MDAEPIANO_VERSION "0.9.3" #define MAX_SOUNDS min(99,int((4096-EEPROM_CONFIGURATIONS)/sizeof(config_t))) @@ -148,19 +150,19 @@ // Encoder min/max values #define ENC_DECAY_MIN 0 #define ENC_DECAY_MAX 99 -#define ENC_DECAY_DEFAULT 49 +#define ENC_DECAY_DEFAULT 50 // #define ENC_RELEASE_MIN 0 #define ENC_RELEASE_MAX 99 -#define ENC_RELEASE_DEFAULT 49 +#define ENC_RELEASE_DEFAULT 50 // #define ENC_HARDNESS_MIN 0 #define ENC_HARDNESS_MAX 99 -#define ENC_HARDNESS_DEFAULT 49 +#define ENC_HARDNESS_DEFAULT 50 // #define ENC_TREBLE_MIN 0 #define ENC_TREBLE_MAX 99 -#define ENC_TREBLE_DEFAULT 49 +#define ENC_TREBLE_DEFAULT 50 // #define ENC_STEREO_MIN 0 #define ENC_STEREO_MAX 99