From c33009867faf989282d39c6ff3ea812d4117129e Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Wed, 30 Jun 2021 20:22:29 +0800 Subject: [PATCH] motor_control: tweak the between-notes delay Also, we need unsigned long to avoid overflowing --- motor_control.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/motor_control.cpp b/motor_control.cpp index 1604283..a436942 100644 --- a/motor_control.cpp +++ b/motor_control.cpp @@ -61,9 +61,9 @@ void MotorControl::Init() { void MotorControl::TickOn(unsigned long period_half_micros) { tick_ctrl.SetPeriod(period_half_micros); - // 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; + // Delay every note for 5 ms to add a bit of gap (attack) between notes + // 5 ms should be short enough (you need > 700 bpm for 1/64 notes to be 5ms long) + next_tick_half_micros = tick_ctrl.NextTick() + (unsigned long) 5 * 1000 * 2; } void MotorControl::TickAtPitch(unsigned int midi_pitch) {