Product SiteDocumentation Site

11.3.13.4. Relative Scheduling

The standard way to schedule things is in a certain number of beats from now. If you're scheduling on a SystemClock, one beat is equal to one second. If you're scheduling on a TempoClock, one beat is equal to whatever the current setting is.
To schedule things on a clock, use the "sched" Function:

nameOfClocksched(beatsFromNow, FunctionToExecute);

The interpreter will let you schedule just about anything, but there's no point in scheduling something other than a Function: scheduling a five won't have any effect - try it!
SystemClock.sched( 5, 5 );
It looks like nothing happens. The 5 does happen, but... well... it doesn't do anything. Scheduling a Function will do something:
SystemClock.sched( 5, { 5.postln; } );
When you run this, there are two things to notice:
  • The interpreter prints out "SystemClock" first. This is to let you know that it did the scheduling as requested.
  • The five prints out endlessly, in five-second intervals. For an explanation, see "Repeated Scheduling"