/*************************************************************************************/
/*                             Simple sine wave spawning and random number generation                                           */
/*************************************************************************************/
/*                             Spawn.ar                                                                                                                          */
/*************************************************************************************/
Spawn: periodic event spawning
Spawn.ar(newEventFunc, numChannels, nextTime, maxRepeats, mul, add)
Instances of Spawn spawn new events at timed intervals and mix them to output channels.
newEventFunc - You supply a function that returns a graph of unit generators. If it returns
nil, then no event is spawned this time. This function is passed three arguments :
 spawn - the Spawn object. You can send messages to the Spawn object from within your
 function to change the nextTime interval, or stop spawning by sending the stop message.
 eventCount - the number of this event which is zero for the first event and increments for
 each event.
 synth - the Synth instance for the event. You can set the block size, channel offset, release time,
 or create synth tasks by sending messages to this synth. (See Synth.help)
numChannels - number of output channels.
nextTime - the time between events in seconds.
maxRepeats - if an integer is specified here, then the newEventFunc will only
be called this many times. If maxRepeats is nil then it will be called indefinitely.

(
 var freq, amp = 0.25;
 { Spawn.ar({ SinOsc.ar(800.rand, 0, amp) }, 1, 1, 4) }.scope;
)