The init block is an optional block that takes care of initializing and storing all variables that might be needed in your algorithm. This is also where the creation of any struct (more on them later) should happen.
- 
    
Here
myVariableis created in theinitblock and passed over thesampleblock (more on it later).myVariablecan then be accessed and modified in thesampleblock, creating an increasing ramp over one second that goes from 0 tosamplerate(samplerateis a keyword to retrieve the current system samplerate).init: myVariable = 0 sample: out1 = myVariable myVariable = (myVariable + 1) % samplerate - 
    
This is a slightly more complex example that shows the use of memory allocation via the creation of a
Delay(more on it later). Here is also used thebuildblock, which only passes specific variables tosample, asinitpasses by default all declared variables in its scope.ins: input params: delayTime {0.5, 0, 1} init: myDelay = Delay(samplerate) #the build block only passes specific variables to perform/sample build: myDelay sample: #write input to the delay line myDelay.write(input) #input + read of the delay line, using the delayTime param as a delay time control outVal = (input * 0.5) + (myDelay.read(delayTime * samplerate) * 0.5) out1 = outVal 
