Classes

Pattern

Defined in classes/Pattern.ts

Patterns are the building blocks of Zen. They are used to generate patterns of values in interesting, concise ways. Pattern methods can be chained together. Pattern methods can be prefixed with a $ to create a new pattern; for example, $add. The results of each pattern are combined together.

s0.p.amp.range(0,1)
s0.px.drive.sine(0,1)
s0.py.modi.range(0,10).mul((t%q)/q)
s0.e.every(3).$and.every(4)

Stream

Defined in classes/Stream.ts

A stream is a musical layer. You can use a stream to map musical parameters across time and space. When a stream triggers an event, musical parameters are determined by the stream's position in time and space. When a stream triggers a mutation, all active events are mutated based on the stream's position in time and space. Streams are available within Zen as s0, s1, s2, s3, s4, s5, s6, s7.

s0.set({inst: 'synth', n: 60}) // set the stream's default parameters
s0.p.lag.set(1).btms()
s0.px._modi.saw(1,10) // map the synth's modulation index across the x axis
s0.py._harm.range(0,10,1) // map the synth's harmonic series across the y axis
s0.x.range(0,16,1) // move the stream across the x axis of the canvas
s0.y.noise(0,16,1,0.5) // move the stream across the y axis of the canvas
s0.e.every(4) // trigger an event every 4 divisions
s0.m.not(s0.e)

Zen

Defined in classes/Zen.ts

The Zen class allows you to set global parameters. It is available within Zen as z.

z.t.range(0, 16, 1) // pattern time
z.bpm.range(60, 120, 1) // pattern bpm
z.s = 16 // size of canvas
z.q = 16 // frames per cycle
z.update = 1 // when to update the executed code, 1 is on the next division, q is on the next cycle etc.
z.set({reverb: 1, rsize: 0.5}) // set global parameters for all streams. Can be overwritten by stream parameters
z.p.n.scales('d-dorian', 16) // set global time parameters using z.p
z.px._modi.range(0, 1, 0.25) // set global stream parameters using z.px
etc.