Tap tempo in FoxDot

Does anyone know how to code tap tempo in FoxDot?

If not, can I use midi in to send tempo from external gear?

Thanks in advance.

Tap tempo doesn’t exist yet but I wrote this script that might be useful (could add it to FoxDot at some point) EDIT: I made it over-complicated to begin with:

class TapTempo:
    def __init__(self):
        self.n = 0
        self.start_time = None
        GUI.text.bind("<space>", lambda e: self.count())
    def count(self):
        print("tap")
        if self.n == 0:
            self.start_time = time.time()
        self.n += 1
        if self.n == 4:
            dur = time.time() - self.start_time
            bpm = (3 / dur) * 60
            Clock.bpm = bpm
            print("Set tempo to", bpm)
            GUI.text.unbind("<space>")
        return "break"

# Run this to start
TapTempo()

Press space 4 times and it will change the tempo for you. As for MIDI that doesn’t exist yet - I don’t have any MIDI devices to test that out I’m afraid. Hope this is useful