Call function after delay

Is there a way to fire a user function after a certain number of milliseconds? Kind of like SendLater but with a function instead of a midi message?

Yes: start a one stop timer in GP script TriggerOneShotRamp() and catch it with the On GeneratorEndCycle() callback

2 Likes

There are ways to do it with ramp functions but there’s currently no “official” approach.

The ability to write

Schedule(callbackName, args....)

is on my list but unfortunately has not been a priority relative to other needs.

4 Likes

Perfect! Thanks a bunch

@rthkeys You are welcome!

BTW: I uploaded a sample script even at the moment, as I was working on something similar the last days :wink:

→ MIDI controlled audio "gate"

2 Likes

Nice! I ended up not using the TriggerOneShotRamp() but was able to achieve what I was trying to do.

Here’s the script. It holds the notes that are played and prevents new notes when the sustain pedal is down. I’m using it to hold pad chords while playing the piano.

[Scriptlet] Chord Lock - auto hold pads with sustain pedal

Ah, I see. Nice.

Maybe an alternative: Thorsten Hillmann - #36 by tripleB
:wink:

1 Like