Tap Tempo

bretvh

Member
Has anyone ventured down the tap tempo path yet? I have some vague ideas about how one could implement it, but have not jumped in yet. A search here or on the Daisy forums/slack does not seem to yield any results.
 

bretvh

Member
Just as a follow up, I have basic LED blinking code working. It's pretty basic, but it seems to track well so far.

I've got it in the infinite loop inside the main function currently. I do not know if it's poor practice to throw the System::Delay call in there. The 1k whine doesn't seem worse with that in place, but I haven't done a full test with all the effects going yet.

tapBypass is a boolean defined globally
bypass is a boolean defined globally and just indicates if the effect is bypassed
SWITCH_1 indicates if delay is bypassed or not

C++:
while (1) {
  // follow delay time and blink LED when the effect and delay are enabled
  tapBypass = tapBypass && hw.switches[Terrarium::SWITCH_1].Pressed() ? false : true;
  System::Delay(currentDelay/100); // maths are not quite right here, it does start to drift
  led1.Set(!bypass && tapBypass ? 1 : 0);
}

Also, Stephen from Electro Smith suggested using a timer to avoid having to do a system delay in case you have other functions in the while loop that need to operate at a different speed. His suggestion was more like the code below, but I had a harder time getting that to sync with the repeats.

C++:
now = daisy::System::GetNow();
 // Update LEDs at ~120Hz
 if(now - ledt > 8)
 {
      ledt = now;
      hw.led_driver.SwapBuffersAndTransmit();
 }
 
Last edited:
Top