Mathematical
Simple mathematical functions that can be applied on any number token. They are generally very simple operations that you might find on a digital calculator or on any interface capable of computation:
Function name | Arguments | Description | Return type |
sin | ...x | Sinusoïd function | 1 or more Number |
cos | ...x | Cosinus function | 1 or more Number |
tan | ...x | Tangent function | 1 or more Number |
abs | ...x | Absolute function | 1 or more Number |
max | ...x | Maximum function | Number |
min | ...x | Minimal function | Number |
mean | ...x | Arithmetic mean function | Number |
scale | [], imin, imax, omin, omax | Scaling a list from range to range | List |
quant | [], [] | Quantize the first list to values in second | List |
clamp | x, y, z | Simple clamping function (x between y and z) | List or Number |
Example of application:
@swim
def demo(p=1/4, i=0):
D('moog:5', lpf='(sin $*2500)', res='(cos $)/2', i=i, legato=0.1)
D('cp', speed='0+(abs -rand*5)', d=8, i=i)
again(demo, p=1/8, i=i+1)
These functions are the bread and butter of a good high-speed Sardine pattern. They will allow you to create signal-like value generators (e.g Low frequency oscillators). They are also very nice to use in connjunction with $
or any timed value. You will find many creative ways to use them (especially by combining with arithmetic operators).