Chipgrid / Documentation / Guides

How the grid works

Ticks, operators, inputs and outputs, bangs, and the order things happen in.

The grid is the program

The grid is 56 cells wide and 28 tall, and each cell holds one character. There is no separate code to run: what is on the grid is the program, and it runs while you edit it.

Three kinds of characters:

  • Operators are uppercase letters and a few symbols: C clock, P pulse, > mover, ! tempo… All operators.
  • Values are digits and lowercase letters: 0–9, then a = 10 up to z = 35. The one exception is v, which is the mover going south.
  • Symbols with a meaning of their own: the bang *, comments #, rails _ and |.

Ticks

The program advances one tick at a time. A tick is a sixteenth note: four ticks to a beat. At 120 BPM there are eight ticks a second. The tick counter in the top bar shows where you are.

Every tick, the grid is read from the top left to the bottom right. Each operator reads the cells around it, its inputs, and most write their result in the cell below, their output. That output can be the input of the next operator down. This is how operators connect: by being placed next to each other.

..2C8
1D2.SCEGEAGED
..P4.12

Here the clock C writes its count below itself, which is the cell left of S, its index. S writes a note below itself, which is P’s note input. Point at any cell and the Cell tab says what it is, what it reads and what it outputs right now. The inputs light up.

Inputs have a fixed place for each operator. Most read the cells on their right; some also read one on their left. An empty input takes a default value. The reference gives the layout of each one.

Bangs

A bang * lives for one tick, then disappears. It is the trigger.

  • Voices (P, G, B, N) play only when a bang touches them: on their left, above or below. A bang on their right does nothing.
  • F (flash) and K (wipe) also wait for a bang.
  • Bangs come from beats (D), from sequences holding * steps, from movers hitting something, from turns on a loop, from links and from the eye ,. You can also type a * by hand next to a voice while it plays: it plays once.

What happens in one tick

The order matters only when operators depend on each other within the same tick. The Manual tab describes it like this:

  1. What runs by itself: clocks, sequences, movers, drawing.
  2. Links: @ sends, & receives, wherever they are on the grid.
  3. What reacts to a bang: ; and the effects M + = % / Z.
  4. What waits behind a gate ?.
  5. Voices, F and K.

So a bang is heard in the same tick, wherever its source is on the grid. A value written lower down than the operator reading it arrives one tick later.

Values and notes

A cell holds a number from 0 to 35, written in base 36: 0–9, then a–z. The first sixteen, 0–f, are also hexadecimal, the way 8-bit programmers wrote numbers. Inputs that were 4-bit on the old chips (colours, noise pitch) go from 0 to f and wrap after that. Results wrap after z, like an odometer.

In a note input, letters are note names first: C D E F G A B, and lowercase is sharp (c = C♯). Digits and h–z count semitones up from C.

Write values in lowercase. Uppercase letters are operators, except inside an input, where they are read as values. All the tables are in Values, notes and colours.

One of a kind: tempo and screen

There is one tempo and one screen palette. If the grid holds several ! (tempo) or several V (screen), the last one you typed or edited holds it, and the others are dimmed. Delete it, and the previous one takes over. A gate can also hand it over on a bang: ?V, ?!.

Comments

# starts a comment, which runs to the next # on the line or to the end of the line. Close your comments with a second # when there is code after them on the same line: otherwise that code is swallowed.

Stop, play and reset

Stop freezes everything: pressing play again carries on from where it stopped. reset stops, puts every mover back where you typed it and clears the screen, without touching your code. new empties the grid. Ctrl+Z undoes either.

Esc