From 20221e4c24fa969894e12799ca6f2a555193426d Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 2 Dec 2018 10:05:04 +0100 Subject: [PATCH 1/4] Fixed bad latency (about 50ms!) with a bad but woking hack. Now the latency is at about 5.5ms. Added a screenshot from latency measurement. --- MicroDexed.ino | 10 +++++++--- doc/MicroDexed_Latency.png | Bin 0 -> 19133 bytes 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 doc/MicroDexed_Latency.png diff --git a/MicroDexed.ino b/MicroDexed.ino index c93a5fb..2d18004 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -118,6 +118,7 @@ uint8_t effect_delay_time = 0; uint8_t effect_delay_feedback = 0; uint8_t effect_delay_volume = 0; bool effect_delay_sync = 0; +elapsedMicros fill_audio_buffer; #ifdef MASTER_KEY_MIDI bool master_key_enabled = false; @@ -330,16 +331,18 @@ void setup() void loop() { int16_t* audio_buffer; // pointer to AUDIO_BLOCK_SAMPLES * int16_t - const uint16_t audio_block_time_ms = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); + const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); // Main sound calculation - if (queue1.available()) + if (queue1.available() && fill_audio_buffer > audio_block_time_us-10) { + fill_audio_buffer = 0; + audio_buffer = queue1.getBuffer(); elapsedMicros t1; dexed->getSamples(AUDIO_BLOCK_SAMPLES, audio_buffer); - if (t1 > audio_block_time_ms) // everything greater 2.9ms is a buffer underrun! + if (t1 > audio_block_time_us) // everything greater 2.9ms is a buffer underrun! xrun++; if (t1 > render_time_max) render_time_max = t1; @@ -364,6 +367,7 @@ void loop() // MIDI input handling handle_input(); + #ifdef I2C_DISPLAY // UI if (master_timer >= TIMER_UI_HANDLING_MS) diff --git a/doc/MicroDexed_Latency.png b/doc/MicroDexed_Latency.png new file mode 100644 index 0000000000000000000000000000000000000000..fc5301d69e7b134672ceb5f26101655a43c0d69d GIT binary patch literal 19133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g0nT@H4j-afJ5?9rF1jx&hK3{E zt|aTcIguV~k(d1~Sh0%U<H1`^buwN~sI=JpEp$=?q)E?)e$r{mZU@=8_mK z^DGo>iNdHxLiU!im!x-Nq#FrLFTMGt1b38hFIUA`TP{@oy2|!N@HnCLaH@cNc_CZs zuoXeC;+lYQhjmf!y(qG$i$zM~gZsY`kbHw+k8Ir9l=+vl!;e2iMlbk2sOCXp&3W61 z-1&Jk^p;~WGcTd`RMUn{#1ApndOF-;_n+Pr*E5AvGm6wqDi3}tj=#Jc`b}Mb{m}a# z0%N8!4-$sXmpY!DzFwl1>% z#+I7BC7x3JqgrP10?z@3X?wFCgX0aZrY*Y(6o^3IIi{$$>SifJ%U?07%T^M&=i+p? zG~iM1In_y9bk6J%QAe-w{ZlY9&nN-`cmJkr8>h}_?q1eV*Lb7DT Date: Sun, 2 Dec 2018 10:24:18 +0100 Subject: [PATCH 2/4] Fixed not working sustain pedal. Fixed enabling of effects. --- MicroDexed.ino | 3 ++- UI.cpp | 2 +- config.h | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 2d18004..635deaa 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -334,7 +334,7 @@ void loop() const uint16_t audio_block_time_us = 1000000 / (SAMPLE_RATE / AUDIO_BLOCK_SAMPLES); // Main sound calculation - if (queue1.available() && fill_audio_buffer > audio_block_time_us-10) + if (queue1.available() && fill_audio_buffer > audio_block_time_us - 10) { fill_audio_buffer = 0; @@ -644,6 +644,7 @@ bool queue_midi_event(uint8_t type, uint8_t data1, uint8_t data2) mixer2.gain(1, mapfloat(effect_delay_volume, 0, 99, 0.0, 1.0)); // delay tap1 signal (with added feedback) break; default: + ret = dexed->processMidiMessage(type, data1, data2); break; } } diff --git a/UI.cpp b/UI.cpp index 71fa6f6..b25e4eb 100644 --- a/UI.cpp +++ b/UI.cpp @@ -74,6 +74,7 @@ void handle_ui(void) #ifdef DEBUG Serial.print(F("Long button pressing detected for button ")); Serial.println(i, DEC); +#endif switch (i) { @@ -103,7 +104,6 @@ void handle_ui(void) } break; } -#endif } else { diff --git a/config.h b/config.h index 02650d2..a0328f9 100644 --- a/config.h +++ b/config.h @@ -35,7 +35,7 @@ #define VERSION 1.0.0 #define MIDI_DEVICE Serial1 #define USE_ONBOARD_USB_HOST 1 -#define MIDI_MERGE_THRU 1 +//#define MIDI_MERGE_THRU 1 #define TEENSY_AUDIO_BOARD 1 #define VOLUME 0.6 #define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI @@ -70,7 +70,7 @@ // Debug output #define SERIAL_SPEED 38400 -#define DEBUG 1 +//#define DEBUG 1 #define SHOW_MIDI_EVENT 1 #define SHOW_XRUN 1 #define SHOW_CPU_LOAD_MSEC 5000 From c173ca1e297f84d627159aca44ffd2337ccfda46 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 2 Dec 2018 10:42:00 +0100 Subject: [PATCH 3/4] Fix for delay time when using a PT8211 (only half the time is possible). --- UI.cpp | 2 +- config.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/UI.cpp b/UI.cpp index b25e4eb..02d27c3 100644 --- a/UI.cpp +++ b/UI.cpp @@ -557,7 +557,7 @@ void ui_show_effects_delay(void) lcd.show(1, 8, 5, "Vol:"); } - lcd.show(0, 9, 4, map(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0, 1200)); + lcd.show(0, 9, 4, map(effect_delay_time, 0, ENC_DELAY_TIME_STEPS, 0, DELAY_MAX_TIME)); lcd.show(1, 4, 2, map(effect_delay_feedback, 0, ENC_DELAY_FB_STEPS, 0, 99)); lcd.show(1, 13, 2, map(effect_delay_volume, 0, ENC_DELAY_VOLUME_STEPS, 0, 99)); diff --git a/config.h b/config.h index a0328f9..953be40 100644 --- a/config.h +++ b/config.h @@ -35,7 +35,7 @@ #define VERSION 1.0.0 #define MIDI_DEVICE Serial1 #define USE_ONBOARD_USB_HOST 1 -//#define MIDI_MERGE_THRU 1 +#define MIDI_MERGE_THRU 1 #define TEENSY_AUDIO_BOARD 1 #define VOLUME 0.6 #define DEFAULT_MIDI_CHANNEL MIDI_CHANNEL_OMNI @@ -44,8 +44,10 @@ //#define DEXED_ENGINE DEXED_ENGINE_MODERN #ifndef TEENSY_AUDIO_BOARD #define AUDIO_MEM 450 +#define DELAY_MAX_TIME 600.0 #else #define AUDIO_MEM 900 +#define DELAY_MAX_TIME 1200.0 #endif #define SAMPLE_RATE 44100 #define MAX_BANKS 100 @@ -62,7 +64,6 @@ // EFFECTS #define FILTER_MAX_FREQ 10000 -#define DELAY_MAX_TIME 1200.0 // Master key handling (comment for disabling) //#define MASTER_KEY_MIDI MIDI_C7 @@ -70,7 +71,7 @@ // Debug output #define SERIAL_SPEED 38400 -//#define DEBUG 1 +#define DEBUG 1 #define SHOW_MIDI_EVENT 1 #define SHOW_XRUN 1 #define SHOW_CPU_LOAD_MSEC 5000 @@ -78,7 +79,7 @@ // Some optimizations #define USE_TEENSY_DSP 1 #define SUM_UP_AS_INT 1 -#define REDUCE_LOUDNESS 1 +#define REDUCE_LOUDNESS 0 // Enable TEST_NOTE for adding code to drop some midi notes for testing without keyboard //#define TEST_NOTE MIDI_E2 From 8815b9870686b36e8eb5dd468f3ad554d4acd33e Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sun, 2 Dec 2018 11:30:19 +0100 Subject: [PATCH 4/4] REDUCE_LOUDNESS is necessary. --- config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index 953be40..12923fe 100644 --- a/config.h +++ b/config.h @@ -71,7 +71,7 @@ // Debug output #define SERIAL_SPEED 38400 -#define DEBUG 1 +//#define DEBUG 1 #define SHOW_MIDI_EVENT 1 #define SHOW_XRUN 1 #define SHOW_CPU_LOAD_MSEC 5000 @@ -79,7 +79,7 @@ // Some optimizations #define USE_TEENSY_DSP 1 #define SUM_UP_AS_INT 1 -#define REDUCE_LOUDNESS 0 +#define REDUCE_LOUDNESS 1 // Enable TEST_NOTE for adding code to drop some midi notes for testing without keyboard //#define TEST_NOTE MIDI_E2