From ac3036011e83a91351526be39de441c8dbd3e58c Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Wed, 30 Jun 2021 20:07:44 +0800 Subject: [PATCH] motor_control: add a little bit of delay between notes --- motor_control.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/motor_control.cpp b/motor_control.cpp index ec41e7c..1604283 100644 --- a/motor_control.cpp +++ b/motor_control.cpp @@ -61,7 +61,9 @@ void MotorControl::Init() { void MotorControl::TickOn(unsigned long period_half_micros) { tick_ctrl.SetPeriod(period_half_micros); - next_tick_half_micros = tick_ctrl.NextTick(); + // Delay every note for 20 ms to add a bit of gap (attack) between notes + // 20 ms should be short enough (you need > 350 bpm for 1/32 notes to be 20ms long) + next_tick_half_micros = tick_ctrl.NextTick() + 20 * 1000 * 2; } void MotorControl::TickAtPitch(unsigned int midi_pitch) {