Chipgrid / Documentation / Guides
Gates and links
Run an operator only on a bang, and carry values and bangs anywhere on the grid, so code can sit where you like.
Operators connect by touching: an output lands in the cell below, where the next operator reads it. That is quick to write, but it makes code grow downwards in tight columns. Gates and links loosen that.
Gates: only on a bang
? is a gate. The operator on its right stops running by itself and runs only when
a bang touches the gate, from the left, above or below.
1D4
..?Xgc4
T4
Without the gate, X would draw a yellow block every tick. With it, the block appears on
each beat, and T4 dissolves it in between.
Some uses:
?X,?Q,?O: draw on the beat.?V: change the palette at a new section, and keep it.?!: change the tempo on cue.?T: fade on the snare.
Voices, F and K already wait for bangs: behind a gate, a bang on the gate fires them as
if it touched them. A gate shown in red can do nothing where it is: in front of a mover,
a swell ;, or an operator that has an input on its left, like C or D.
Named links: wires without cables
@ sends over a named link: the value on its left, or a bang if a bang is on its left,
above or below. & with the same name receives it, anywhere on the grid, and writes it
below itself.
1D4
..@k
.
.
.
&k
.P4C24
The beat’s bang goes into @k, comes out of &k four rows down, and plays the pulse. The
two ends could be at opposite corners of the grid.
- The name is the cell right of
@or&. Several&can listen to one name. - A bang arrives in the same tick. A value reaches a voice in the same tick, and other operators on the next one.
- A lowercase name is yours alone. An uppercase name is shared with the whole
room in multiplayer: one player sends on
B, and whoever wants it listens. In solo, both work the same.
Sending to a cell: Y
Y sends the value on its left to a cell dx to the right and dy down. Use it when an
input cannot be fed from just above, for example the y of an X whose x is already
fed by a wave:
3Wn9
..Y42
....4Wu
....X..4
T2
The wave on the third row feeds X’s x from above. The other wave, on the first row, goes
through Y42: 4 cells right and 2 down from Y, which is X’s y. Two waves at different
speeds, one on each axis, draw a Lissajous figure.
Copying down: J
J copies the cell above it to the cell below. A column of J carries one clock past
several sequences, as in the drum pattern of First steps.
Where to go next
The tutorial chapters Gates and links and Switches build these step by step: read them. The Routes examples combine links and switches.