potatoslicer

Song Format

Songs are JSON files. One file contains everything — instruments, patterns, arrangement, and metadata.

Example Song

json +
{
  "title": "My Song",
  "tempo": 122,
  "rows_per_beat": 4,
  "order": [0, 0, 1, 1, 2, 3],
  "instruments": {
    "stab": {
      "waveform": "pulse",
      "duty_cycle": 0.25,
      "attack": 0.001,
      "decay": 0.04,
      "sustain": 0.0,
      "release": 0.03,
      "volume": 0.13
    }
  },
  "patterns": {
    "0": [
      [{ "channel": 0, "note": "C-1", "instrument": "kick" }],
      [],
      [{ "channel": 2, "note": "C-5", "instrument": "hat" }],
      []
    ]
  }
}

Top-Level Fields

FieldDescription
titleSong name (display only)
tempoBPM (beats per minute)
rows_per_beatRows per beat. 4 = 16th note resolution
orderPattern play sequence, loops when finished
instrumentsNamed instrument definitions
patternsNumbered patterns, each a list of rows

Pattern Events

Each row is a list of events (or empty [] for silence):

json +
{ "channel": 0, "note": "C-5", "instrument": "lead", "volume": 0.8 }
FieldDescription
channelVoice channel (0-7)
noteSingle "C-5", chord ["C-4","E-4","G-4"], or "---" for note off
instrumentInstrument name
volumeOptional, 0.0-1.0

Note Format

  • C-5 — C in octave 5
  • C#4 — C sharp in octave 4
  • --- — note off (releases all voices on channel)

Timing

text +
seconds_per_row = 60 / tempo / rows_per_beat

| Tempo | Rows/beat | Row duration |
|-------|-----------|-------------|
|   120 |         4 |       125ms |
|   122 |         4 |       123ms |
|   140 |         4 |       107ms |