Running Complete Scripts

All above examples were used in a live-coding scenario. The commands were executed in blocks or single lines, step after step. For running a complete script,routines can help to keep the server synchronized. In addition, the server needs to be booted before any server-side operations take place. This can be done with different methods.


Wait for Boot

Server.waitForBoot boots a server and, when completed, runs the function passed to it as an argument:

s.waitForBoot({

   // a sine oscillator node with one parameter
   var x = {|freq=100| Out.ar(0, SinOsc.ar(freq))}.play;

});

Do when Booted

Server.doWhenBooted need the server to be started with an extra command:

s.doWhenBooted({

    // a sine oscillator node with one parameter
    var x = {|freq=100| Out.ar(0, SinOsc.ar(freq))}.play;

});

s.boot;