SynthMaker Manual Open SynthMaker (opens in a new tab)
The Patch

A wire that knows it's a bus

Wire a grid of pads into a module and the wire changes by itself: it turns thicker, says how many pads it carries, and every module it reaches makes a row for each pad.

New words

The Patch is the picture of a sound: its modules (an Oscillator, a Filter, an Envelope) as boxes, and the wires between them.

A grid of pads is a block of pads on a module's face, rows by columns, each one a button you press.

A bus is one wire that carries the presses of every pad of a grid, drawn thicker, with its name: Chords ×16.

A tag is what each press says about where it came from: which grid, and which pad. Chords 3 is pad 3.

Chord Pads: a 4 by 4 grid of pads, pad 1 lit, beside its Patch, where a thick green wire labelled Chords ×16 runs from Chord Pads into a Chord, and the Voice's wires glow.
Hold a pad: it lights and plays its chord. Pads 9 to 16 are left without a chord on purpose, to show the amber note. Open the example sound: Chord Pads ↗ (opens in a new tab)

1One button, one wire

Start with a module of your own, Chord Pads, whose face has a single button, Play. Its wire into a Chord is a plain green message wire: every press sends the same message, so the Chord plays its own chord every time.

Chord Pads with one output, play, wired by a thin green wire into the Chord's play.
Chord Pads with one output, chords.onPressingChanged, wired by a thicker green wire labelled Chords ×16 into the Chord's play.
The same two modules, before and after the button becomes a grid.
  1. Chord Pads, with one Button: Play.
  2. A plain green message wire.
  3. The Chord.
  4. The wire's name, once, at the port it leaves: Chords ×16, the grid's name and its number of pads.
  5. The bus: thicker, labelled Chords ×16.
  6. The same Chord, unchanged.

2Sixteen pads, one bus

Now give the face a grid instead of the button.

  1. On Chord Pads' card, choose Edit face. Under its views, type the grid's name, Chords, set it to 4 × 4, and choose Add a grid of pads.
    The face editor's add row: Add a knob for…, Add a row, a Text field and Add text, then the grid's name Chords, 4 × 4, adaptive, and Add a grid of pads.
  2. The face now has the grid: sixteen pads, numbered 1 to 16.
    Chord Pads' card with its title and a 4 by 4 grid of pads numbered 1 to 16.
  3. Choose Edit the wiring and wire Chord Pads' new output, chords.onPressingChanged, into the Chord's play. The wire turns into the bus.
    Chord Pads wired into the Chord by a thick green wire labelled Chords ×16.

That's all. You never tell the wire it's a bus: it sees that its messages come from a grid, and draws itself as one, in Nested and Flat, inside custom modules and out.

One Pad for the whole grid

The grid is one view, so it has one Pad, chords, and the Patch draws one card for it however many pads it has. Its outputs are a single button's: action, a tap when the press ends, and with SwiftUI's press gesture, .onLongPressGesture(minimumDuration: 0) from the face editor's modifiers, perform and onPressingChanged. Chord Pads has the gesture and wires chords.onPressingChanged, so a pad plays while you hold it and stops when you let go.

Inside Chord Pads: one Pad card, chords, with isLit in and action, perform and onPressingChanged out, and the face's box, Face · VStack · 1 Text, 1 grid.
Inside Chord Pads: one Pad for all sixteen pads.
  1. The grid's one Pad.
  2. action: a tap.
  3. onPressingChanged: on, then off.

3Point at the bus to see what it carries

In SynthMaker, point at the bus (or tap it on a touch screen) and it lists its tags: the label as a header, then one row per pad, as the code names it from here. A tap's list stays for four seconds. Over sixteen pads, the rows go in columns of sixteen. Try it on the picture: point at the ringed bus.

Chord Pads wired into the Chord by the bus labelled Chords ×16.
The same, with the bus's list: Chords ×16, then chordPads.chords[1] to chordPads.chords[16].
  1. The label.
  2. Its tags, one per pad: chordPads.chords[3] is pad 3 of the grid chords inside chordPads. A pad with a title shows it too.

4Tags in code

In the Code view a pad is written as the grid with its number in brackets: chordPads.chords[3], as a Swift subscript names an item without calling it. The face calls that same pad with chords(3), and the bus is the one wire from the grid.

Chord Pads · SMPL, the bus and its Pad
chordPads = ChordPads()  …chordPads.chords.onPressingChanged -> chord -> voice  …patch ChordPads "Chord Pads"  chords = Pad()  …end
Inside Chord Pads: the Pad chords.
The Pad the code calls chords = Pad().

Remember