Scrimshaw Jukebox

Scrimshaw Jukebox

Six original adventure-game tracks, written as plain text and played by a synthesizer running in your browser. Pick a tune, press Play, then open the score and change it.

Moonlit HarborPress Play

Score view

—
0:00▏ loop starts here0:00

Click a voice to mute it. Click or drag the section bar to jump; arrow keys step between sections. Space bar plays and pauses.

Tracks

Open a folder of .scrim files to work on them live: a file named like a track above takes its place, others are listed after the albums. A NAME.scene.js beside NAME.scrim gives that track its own animation. Changes on disk are picked up automatically.

Score

01-moonlit-harbor.scrim

The Scrimshaw score format

How a score is laid out

A score is a plain text file read from top to bottom: settings, then voices (who plays what), then patterns (blocks of bars), then the arrangement. Every bar is cut into the same number of steps. Each note takes one step plus one per dash, so rhythm is just counting. If a bar doesn't add up, the editor tells you which line and how many steps it found.

Comments start with # at the start of a word, so F#4 is still a note.

# a tiny calypso
title  Harbour Lights
tempo  100      # beats per minute
beats  4        # beats in a bar
steps  4        # steps per beat: 16 per bar
swing  0.12     # nudge every other step late

voice lead  steeldrum vol=0.9 pan=-0.2
voice chord organ     gate=0.45 center=A4
voice bass  fretless
voice kick  kick

pattern A
lead  | A4-- D5-- F5- E5 F5 E5 D5 A4--- |
chord | . . [Dm]- . . [Dm]- . . [Dm]- . . [Dm]- |
bass  | D2-- A2-- D3- C3-- A2-- F2 E2 |
kick  | x... ..x. x... ..x. |

play  A         # once
loop  A A+2     # then forever (A+2 = up a tone)

Patterns and arrangement

Write as many lines per voice as you like inside a pattern; they join end to end. pattern A2 from A starts as a copy of A, and any voice you write in A2 replaces A's part. mute bass inside a pattern silences a voice. A tempo, beats, steps or swing line inside a pattern (or steps=4 on its pattern line) changes only that pattern. rit 72 (or rit=72) slows the pattern down smoothly from its tempo to 72 by its last step, for a ritardando; accel 132 speeds it up the same way, for an accelerando.

play lists patterns to hear once, loop lists the part that repeats, as game music does. B*2 repeats a pattern, A+5 or A-2 transposes it. Drums don't transpose.

Meters

beats 4 + steps 4 is 4/4 in sixteenths. beats 2 + steps 3 is a 6/8 jig. beats 3 + steps 2 is a waltz in eighths. Swing only applies when steps is even; 0.33 gives a triplet shuffle.

human 0.5 (the default) plays the score like a band would: a few milliseconds off the grid, strong beats a little louder, basses and strings laid back, hats pushing ahead and guitar chords strummed. human 0 is strict machine timing; human=0 on a voice keeps just that voice on the grid.

Inside a bar

WriteMeans
D5 F#4 Bb3A note, one step long. Octave 4 starts at middle C.
D5---Each dash adds a step, so this lasts four.
. .... .---Silence: each dot or dash is a step.
-On its own: keep the last note sounding, even across a bar line.
C4+E4+G4Notes struck together.
[Dm7] [C/E]A chord by name, voiced near the voice's center. A slash adds a bass note.
D5! D5??Louder or softer. Stack them for more.
~A2Slide into the note from the previous one.
% _ =Whole bar: repeat the previous bar, rest, or hold the last note through it.

Drum lanes

A voice played by a drum reads one character per step: x hit, X accent, o ghost note, . nothing. Spaces are ignored, so group by beat: x... ..x. x... ..x.

Voice options

vol=0.8Level, 0–2
pan=-0.3Left −1 to right 1
rev=0.4Reverb send, 0–1
oct=-1 trans=3Shift by octaves or semitones
gate=0.5Play each note for this fraction of its length
center=A4Where chord names are voiced
glide=0.1Slide time in seconds for ~ notes
bright=1.5 att= rel=Tone colour, attack and release (seconds)
human=0How loosely this voice plays, from 0 (on the grid) to 1; overrides the score's human

Instruments

Mallets & bells
steeldrum marimba vibes celesta glock xylophone musicbox bell
Keyboards
piano organ pipe harpsichord
Strings
strings pizz fiddle harp guitar banjo upright
Winds & brass
flute clarinet oboe bassoon accordion trumpet brass horn tuba
Voices & pads
choir voices pad
Bass & timpani
fretless synbass timpani
Plain synths
chip sine square saw triangle
Drums
kick snare brush rim hat ohat ride crash clap
Hand percussion
conga tumba bongo bongolo timbale bodhran shaker tamb clave block cowbell guiro tri
Toms & effects
tomlo tommid tomhi gong thunder surf
Chord names
[C] [Cm] [C7] [Cm7] [Cmaj7] [C6] [Cm6] [C9] [Cm9] [Cadd9] [Csus2] [Csus4] [C7sus4] [Cdim] [Cdim7] [Cm7b5] [Caug] [C5] [C7b9]

Animated scenes

A track in an open folder can bring its own picture: put NAME.scene.js next to NAME.scrim. Tracks without one, and any scene that throws an error, show the harbour. Scene files are code that runs in this page, so only open folders you trust.

scene(function (api) {        // api: W, H (320×120), reduceMotion, px(g, x, y, w, h, colour), bayer, rig
                               // rig: poseable figures that walk with planted feet (scrimshaw-rig.js; see its header)
  return {
    label: 'What the picture shows, for screen readers',
    thumbnail: 54,             // optional: the song time (seconds) the track list's still is drawn at; 40% through if left out
    frame(g, info) {           // about 30 times a second
      // info.playing, info.paused (held at songTime), info.finished (played to the end), info.t, info.dt, info.songTime, info.energy (0–1)
      // info.sec (name, trans, bars, beats, tempo, endTempo, barDur, timeAt(bar, beat), posAt(secTime)), info.bar (from 1), info.beat (0 to beats, fractional)
      // info.progress (0–1 through the section), info.index, info.sections, info.song
      // info.events: notes and hits sounding now, as { name, inst, drum, notes, vel, dur, color }
    }
  };
});

Compose with an LLM

This prompt teaches any LLM the Scrimshaw format. Copy it into a chat, add a line describing the music you want, then paste the score it writes into the editor above and press Play this score. If the editor reports errors, paste them back to the model and ask for a fix.

You are composing music in the Scrimshaw score format: plain text that a web page plays through a Web Audio synthesizer, in the style of early-1990s adventure game soundtracks. Your score will be pasted into an editor and played straight away, so follow these rules exactly. The most common mistake is a bar with the wrong number of steps, so count every bar.

## What to reply with

One complete score in a single fenced code block, followed by no more than a couple of sentences about it. Only use the keywords, instruments, chord names and symbols described here. If I paste back error messages from the editor, fix the lines they point to and reply with the whole corrected score.

## Layout

A score is read from top to bottom, one statement per line, in this order:

1. Settings for the whole song
2. `voice` lines, declaring each part and its instrument
3. `pattern` blocks: a pattern line followed by its music lines
4. `play` and `loop` lines: the arrangement (always last)

A `#` at the start of a word begins a comment that runs to the end of the line. `F#4` is still a note because its `#` is inside a word. Blank lines are ignored.

## Settings

```
title    The Name of the Piece
composer Your Name   # optional
about    One or two sentences. The first sentence is shown as a caption while it plays.
tempo    100         # beats per minute, 20 to 400 (default 120)
beats    4           # beats per bar, 1 to 16 (default 4)
steps    4           # steps per beat, 1 to 12 (default 4)
swing    0.12        # delays every other step, 0 to 0.75 (default 0)
reverb   0.3         # overall reverb, 0 to 1 (default 0.3)
human    0.5         # how loosely it's played, 0 to 1 (default 0.5)
```

A step is the smallest unit of rhythm. Every bar holds exactly beats × steps steps:

- `beats 4` `steps 4`: 4/4 in sixteenth notes, 16 steps per bar
- `beats 4` `steps 2`: 4/4 in eighth notes, 8 steps per bar
- `beats 3` `steps 2`: a 3/4 waltz in eighths, 6 steps per bar
- `beats 2` `steps 3`: a 6/8 jig, 6 steps per bar (tempo counts dotted quarters)
- `beats 4` `steps 3`: a 12/8 shuffle, 12 steps per bar

Swing only works when steps is even. 0.1 to 0.15 is a light lilt; 0.33 gives a triplet shuffle.

`human` plays the score like people would: notes land a few milliseconds off the grid, strong beats come out a little louder than the steps between them, basses and strings sit slightly behind the beat, hats push slightly ahead, and guitar, banjo, harp, piano and harpsichord roll their chords. It never changes the notes, and a score sounds the same every time it plays. `human 0` is strict machine timing; 1 is a loose band.

## Voices

```
voice NAME INSTRUMENT key=value key=value ...
```

Names use letters, digits and underscores, and each is declared once. Every voice used in a pattern must be declared. There is no drum kit instrument: give each drum sound its own voice (one for kick, one for snare, one for hat and so on).

Voice options:

- `vol=0.8` level, 0 to 2 (default 0.8)
- `pan=-0.3` stereo position, -1 left to 1 right (default 0)
- `rev=0.4` reverb send, 0 to 1
- `oct=-1` shift by whole octaves
- `trans=3` shift by semitones
- `gate=0.5` sound each note for this fraction of its written length, 0.05 to 1 (default 1). 0.4 to 0.6 gives short, detached chords
- `center=A4` the pitch that chord names are voiced around (default D4)
- `glide=0.1` slide time in seconds for `~` notes (default 0.07)
- `bright=1.5` tone brightness, 0.1 to 4 (default 1)
- `human=0` how loosely this voice plays, 0 to 1 (default: the score's `human`). Use 0 for a drum machine or arpeggiator that should stay on the grid
- `att=0.05` attack time in seconds
- `rel=0.5` release time in seconds

Melodic instruments:

- Mallets and bells: steeldrum marimba vibes celesta glock xylophone musicbox bell
- Keyboards: piano organ pipe harpsichord
- Strings: strings pizz fiddle harp guitar banjo upright
- Winds and brass: flute clarinet oboe bassoon accordion trumpet brass horn tuba
- Voices and pads: choir voices pad
- Bass and timpani: fretless synbass timpani
- Plain synths: chip sine square saw triangle

Drum instruments, one sound per voice:

- Kit: kick snare brush rim hat ohat ride crash clap
- Hand percussion: conga tumba bongo bongolo timbale bodhran shaker tamb clave block cowbell guiro tri
- Toms and effects: tomlo tommid tomhi gong thunder surf

Some of these names are short: pipe is a pipe organ, pizz is pizzicato strings, upright is an upright bass, chip is a square-wave game console lead, brush is a snare played with wire brushes (a soft tap with a swish after it; ghost notes are nearly all swish), ohat is an open hi-hat, tamb is a tambourine, tri is a triangle, thunder is a long thunder roll and surf is a wave breaking on a beach (both last several seconds).

## Patterns

```
pattern NAME
VOICE | bar | bar | bar | bar |
VOICE | bar | bar | bar | bar |
```

Pattern names use letters, digits and underscores, like `A`, `B2` or `intro`. A music line is a voice name followed by bars separated by `|`. There must be a `|` straight after the voice name; the closing `|` is optional. A bar can't be empty: write `_` for a silent bar.

- A voice can have several lines in one pattern; they join end to end. Keep lines to about four bars.
- Voices left out of a pattern are silent during it.
- A pattern lasts as long as its longest voice, so give every voice in it the same number of bars.
- `pattern A2 from A` starts as a copy of pattern A. A voice written in A2 replaces that voice's whole part from A; the other voices carry over unchanged.
- `mute NAME` inside a pattern silences that voice (handy after `from`).
- A `tempo`, `beats`, `steps` or `swing` line inside a pattern changes only that pattern. These can also go on the pattern line: `pattern slow tempo=80 swing=0`
- `rit 72` inside a pattern (or `rit=72` on its pattern line) slows it down smoothly from its tempo to 72 over its length: a ritardando, for endings and big arrivals. `accel 132` (or `accel=132`) speeds it up the same way: an accelerando, for build-ups, chases and runaway machines. A rit must end slower than the pattern's tempo and an accel faster. The next pattern starts at its own tempo, so carry on from where the last one ended: `pattern slowing tempo=108 rit=92` then `pattern ending tempo=92 rit=70`, or `pattern faster tempo=100 accel=120` then `pattern flatout tempo=120`

## Melodic bars

A melodic bar is a row of tokens separated by spaces. Each token takes up a number of steps, and together they must add up to exactly beats × steps.

- Note: a letter A to G, an optional accidental (`#` `##` `b` `bb`), then an octave 0 to 8. `C4` is middle C, `B3` is just below it, `A4` is 440 Hz. Examples: `D5` `F#4` `Bb3`. A note lasts one step.
- Each dash after a note adds a step: `D5---` lasts four steps.
- Rest: each `.` is one step of silence, and dashes after a dot add more rest: `.` is 1 step, `....` is 4, `.---` is 4, `.-------` is 8.
- A token of dashes on its own (`-` or `---`) keeps the previous note sounding for that many more steps. Use it to tie a note across a bar line.
- Notes struck together are joined with `+` and no spaces: `C4+E4+G4`. Dashes go at the end: `C4+E4+G4---`
- A chord name in square brackets, voiced close to the voice's `center`: `[Dm]` `[G7]` `[Bbmaj7]`. A slash adds a bass note below: `[C/E]` `[D/F#]`. Dashes extend it: `[Dm]---`
- Dynamics: `!` after a note makes it louder, `?` makes it softer. Stack them for more: `D5!!` `A2??`. They go right after the note or after its dashes: `[Dm]?---` or `D5---!`
- Slide: `~` before a note glides into it from that voice's previous note: `~A2--`

Symbols that fill a whole bar, alone between the bar lines:

- `%` repeats the previous bar
- `_` is a silent bar
- `=` holds the note that was sounding at the end of the previous bar through this whole bar

Chord names are a root (A to G, optionally followed by `#` or `b`) then one of these suffixes, or no suffix for a major triad:

m 7 m7 maj7 mmaj7 6 m6 9 m9 maj9 add9 madd9 sus2 sus4 7sus4 dim dim7 m7b5 aug 5 7b9

Examples: `[C]` `[Am]` `[F#m7]` `[Ebmaj7]` `[Dsus4]` `[G7b9]` `[Bdim]` `[Em/G]`

## Drum bars

A voice played by a drum instrument reads one character per step:

- `x` a hit
- `X` an accented hit
- `o` a quiet ghost note
- `.` nothing

Spaces are ignored, so group the characters by beat. With 16 steps per bar: `x... ..x. x... ..x.` With 6 steps per bar: `X.x x.x`. The whole-bar symbols `%` and `_` work in drum lines too. A drum bar still needs exactly beats × steps characters, not counting spaces.

## Arrangement

```
play intro            # patterns played once, in order
loop A A2 B*2 A2+2    # patterns that then repeat forever
```

- `B*2` plays a pattern twice.
- `A+5` or `A-2` transposes a pattern up or down by that many semitones. Drums are not affected. Both can be combined: `A+2*2`
- With no `play` or `loop` line, every pattern loops in the order it was written.
- Like game music, the loop repeats forever, so make the end of the loop lead smoothly back to its beginning.

## Count every bar before you reply

A note or chord counts 1 plus its dashes. A rest counts its dots plus its dashes. A lone dash token counts its dashes. A drum bar counts its characters, ignoring spaces. Worked examples at 16 steps per bar:

```
E5-- G5-- B5- A5 G5 F#5 E5 D5---       3+3+2+1+1+1+1+4 = 16
.- [Em]- .- [Em]- .- [Em]- .- [Em]-    2+2+2+2+2+2+2+2 = 16
A5------- .... D5 E5 F#5! G5!          8+4+1+1+1+1 = 16
x... .... x... x.x.                    16 characters
```

## Example score

```
title    The Lighthouse Keeper
composer Claude
about    A quiet theme for a lonely lighthouse. Clarinet over a soft calypso groove.
tempo    92
beats    4        # 4 beats per bar
steps    4        # 4 steps per beat, so every bar holds 16 steps
swing    0.1
reverb   0.35

voice lead    clarinet vol=0.95 pan=-0.15
voice counter vibes    vol=0.7  pan=0.35
voice chords  guitar   vol=0.7  pan=0.25 gate=0.5 center=G4
voice pad     strings  vol=0.4  pan=-0.3 center=E4
voice bass    upright  vol=0.95
voice kick    kick     vol=0.75
voice snare   snare    vol=0.45 pan=0.1
voice hat     hat      vol=0.4  pan=0.3
voice ride    ride     vol=0.35 pan=0.3
voice crash   crash    vol=0.3

pattern intro
pad     | [Em]--------------- | = | [D/F#]--------------- | [D]--------------- |
counter | B4------- E5------- | G5--------------- | F#5------- A5------- | F#5------- D5------- |
hat     | _ | _ | _ | x.x. x.x. xxxx XXXX |

pattern A
lead   | E5-- G5-- B5- A5 G5 F#5 E5 D5--- | C5-- E5-- G5- F#5 E5 D5 C5 B4--- |
lead   | B4-- D5-- G5- A5--- B5- A5 G5 | A5------- F#5- E5- D5- F#5- |
chords | .- [Em]- .- [Em]- .- [Em]- .- [Em]- | .- [C]- .- [C]- .- [C]- .- [C]- |
chords | .- [G]- .- [G]- .- [G]- .- [G]- | .- [D]- .- [D]- .- [D]- .- [D]- |
pad    | [Em]?--------------- | [C]?--------------- | [G]?--------------- | [D]?--------------- |
bass   | E2--- B1--- E2--- ~G2--- | C2--- G1--- C2--- E2--- |
bass   | G1--- D2--- G2--- B1--- | D2--- A1--- D2--- F#2--- |
kick   | x... .... x... .... | % | % | x... .... x... x.x. |
snare  | .... x... .... x... | % | % | .... x... .... X.oo |
hat    | x.x. x.x. x.x. x.x. | % | % | % |
crash  | X... .... .... .... | _ | _ | _ |

# A2 copies A; the parts written here replace or add to A's
pattern A2 from A
mute    hat
ride    | x.x. x.xo x.x. x.xo | % | % | % |
counter | B5------- G5------- | G5------- E5------- | D6------- B5------- | A5--------------- |

pattern B
lead   | C6--- B5- A5- E5------- | B5--- A5- G5- E5------- |
lead   | E5- G5- C6- E6- D6--- C6- B5- | A5------- .... D5 E5 F#5! G5! |
chords | .- [Am]- .- [Am]- .- [Am]- .- [Am]- | .- [Em/G]- .- [Em/G]- .- [Em/G]- .- [Em/G]- |
chords | .- [C]- .- [C]- .- [C]- .- [C]- | .- [D]- .- [D]- .- [D7]- .- [D7]- |
pad    | [Am]--------------- | [Em/G]--------------- | [C]--------------- | [D]------- [D7]------- |
bass   | A1--- E2--- A2--- E2--- | G1--- B1--- E2--- G2--- |
bass   | C2--- G2--- C3--- G2--- | D2------- ~A2--- D2--- |
kick   | x... ..x. x... ..x. | % | % | x... x... x.x. XXXX |
snare  | .... x... .... x... | % | % | .... x... ..x. xoXX |
hat    | x.x. x.x. x.x. x.x. | % | % | % |
crash  | X... .... .... .... | _ | _ | _ |

play intro
loop A A2 B*2 A2+2
```

## Composing tips

- Write a short intro that plays once, then a loop of 16 to 48 bars built from two to four patterns, so the music develops before it repeats.
- Typical ranges: bass in octaves 1 and 2, chords and pads centered in octave 4 (`center=E4` or `center=G4`), melodies in octaves 4 to 6.
- Use `pattern X2 from X` to vary a section with a counter-melody or a different drum part without rewriting it.
- Use `%` for repeated bars, especially in drum parts, to keep the score short.
- Balance levels with `vol`: pads and percussion around 0.3 to 0.7, the lead around 0.9 to 1.1.
- Choose a key and a chord progression first, then write the melody over it. The bass usually plays chord roots on the strong beats.

Compose the piece I describe below. If I haven't described one, compose an original piece in a style of your choice.

Animate with an LLM

This prompt teaches any LLM to write a NAME.scene.js: a pixel-art picture that plays along with a score. Copy it into a chat, paste the score below it and describe the scene you want. Save the reply as NAME.scene.js next to NAME.scrim in your open folder; the jukebox picks it up automatically. If the scene fails, the jukebox shows the harbour and an error message: paste that back to the model and ask for a fix.

You are writing an animated scene for the Scrimshaw jukebox: a small JavaScript file that draws a pixel-art picture, in the style of early-1990s adventure games, that plays along with a piece of music written in the Scrimshaw score format. The file runs inside the jukebox page about 30 times a second and draws onto a 320×120 canvas that the page scales up with hard pixel edges. I'll give you the score and describe the scene I want.

## What to reply with

One complete file in a single fenced `js` code block, followed by no more than a couple of sentences about it. It will be saved as `NAME.scene.js` next to the score `NAME.scrim`. Use plain browser JavaScript with no imports, no network requests, no images or fonts to load, and nothing outside the canvas you're given. If I paste back an error message, fix it and reply with the whole corrected file.

## The contract

The file calls `scene()` exactly once, with a factory function. The factory runs once when the scene loads; it gets `api` and returns an object with a `label` and a `frame(g, info)` method:

```js
scene(function (api) {
  const { W, H, reduceMotion, bayer, px } = api;
  // build anything static here: palettes, offscreen canvases, figure layouts
  return {
    label: 'Pixel-art café at dusk where a scarecrow sings on a hay-bale stage',  // read out by screen readers
    thumbnail: 54,   // the song time, in seconds, of the still shown in the track list (pick a telling moment)
    frame(g, info) {
      g.imageSmoothingEnabled = false;
      // draw the whole picture, every frame
    }
  };
});
```

- `api.W`, `api.H`: the canvas size, 320 and 120.
- `api.reduceMotion`: true when the viewer prefers less motion. Then keep the story but drop shaking, bouncing, flicker and particles, and cut instead of panning the camera.
- `api.bayer`: a 4×4 ordered-dither matrix with values 0 to 15, for dithered gradients and soft glows the pixel-art way.
- `api.px(g, x, y, w, h, colour)`: fills a rounded rectangle; `w` and `h` default to 1.
- `api.rig`: the Scrimshaw rig (`scrimshaw-rig.js`), optional. `api.rig.create({ floor, ... })` gives poseable side-view figures: you describe each character's skeleton lengths and draw its looks in callbacks, and the rig lays figures out from poses (joint angles), blends poses, plants hands and feet, and walks figures in time with the beat with their feet planted. Its header comment documents the API. Simple scenes don't need it; draw figures directly instead.
- `g` is the canvas 2D context. Each call to `frame` is wrapped in `save()` and `restore()`, so you may translate and scale for a camera. Paint every pixel every frame (start with a full background), because nothing clears the canvas for you.
- The track list shows a still of the scene: a separate copy of it, drawn once with `playing` true, `dt` of 1 and no events at the song time in `thumbnail` (40% of the way through if you leave it out). Pick a moment that sums the piece up, and make sure a single frame there looks right without any earlier frames.
- If the factory or `frame` throws, the jukebox shows its built-in harbour instead and reports the error, so guard against missing values rather than assuming them.

## What info tells you

- `info.playing`: whether the music is playing. When it's false and `info.finished` is false, draw a calm opening tableau. When `info.finished` is true, the track has just played to the end: draw a closing picture.
- `info.paused`: true when the track is paused. Then `playing` is true as well and the section, bar and beat stay at the paused moment, so the scene holds that picture; `events` stays empty and only `info.t` moves on.
- `info.t`: seconds on a clock that keeps running even when stopped; `info.dt`: seconds since the last frame (at most 0.1). Use these for idle motion such as flickering flames, drifting steam and twinkling stars.
- `info.songTime`: seconds into the song; `info.energy`: a smoothed 0–1 loudness.
- `info.sec`: the section playing now, or null when stopped. A section is one entry of the score's `play` or `loop` line: `{ name, trans, start, dur, bars, beats, steps, tempo, barDur }`. `name` is the pattern's name, `trans` its transposition in semitones (the `+2` in `chorus+2`), `start` and `dur` its time in seconds and `beats` the beats per bar. A section played at a steady tempo has `barDur` seconds per bar. A pattern with `rit` or `accel` slides from `tempo` to `endTempo` as it goes, so its bars get longer or shorter and `barDur` is only their average: there, `info.sec.timeAt(bar, beat)` gives the seconds into the section at a bar (from 1) and beat (from 0), and `info.sec.posAt(seconds)` gives back `{ bar, beat }`. Both work on every section, and on any entry of `info.sections`.
- `info.bar`: the bar within the section, counting from 1. `info.beat`: the beat within the bar, fractional, from 0 up to `beats`. `info.progress`: 0–1 through the section; `info.secTime`: seconds into it.
- `info.index`: which section of `info.sections` is playing. `info.sections` lists every section of the part playing now, in order. `info.part` is `'intro'` while the score's `play` line runs and `'loop'` during its `loop` line, and section `start` times count from the beginning of that part; `info.loop` counts the times the loop has come round.
- `info.events`: the notes and hits that started since the last frame, each as `{ name, inst, drum, notes, vel, dur, color }`. `name` is the voice's name in the score, `inst` its instrument, `drum` true for drum voices, `notes` the MIDI note numbers (null for drums), `vel` the velocity and `dur` the length in seconds. It's empty when stopped.

## How to stage it

- Read the score first. List its sections in the order they play, work out roughly when each starts (`bars × beats × 60 / tempo` seconds each, at the pattern's own tempo if it sets one, longer if it has a `rit` that slows it down and shorter if it has an `accel`) and what the music is doing in each: who has the tune, where the hits, key changes, breaks and solos are. Then plan one story beat per section so the picture tells the same story as the music.
- Work everything out from where the song is: `info.sec.name`, `info.sec.trans`, `info.bar` and `info.beat` (these follow a `rit` or `accel` exactly). For the moment a given bar and beat comes round, use `sec.start + sec.timeAt(bar, beat)`, not a multiple of `barDur`. A switch on the section name, then on the bar, is the clearest way to write it. Positions should be a function of time (for example `x = lerp(a, b, ease(beat / 2))`), not something added to each frame, so that seeking, looping and a reload in the middle of the song all draw the right picture straight away.
- Use `info.events` only for flourishes that can be missed: a mouth that opens on a melody note, a drum that jumps on a hit, sparks or confetti on a crash. Keep a short list of particles and cap its length.
- Make things move on the beat. `Math.exp(-(info.beat % 1) * 4)` is a pulse that jumps on every beat and dies away; `Math.sin(beatsIntoSection * Math.PI)` sways once every two beats.
- A gliding camera brings the picture to life: keep its zoom and position between frames, ease them towards each moment's shot with `1 - Math.exp(-dt * 4)`, and snap straight there when stopped or when `reduceMotion` is set. Apply it with `g.translate` and `g.scale`, and never zoom out past the whole 320×120 picture.

## Pixel art rules

- Round every coordinate to a whole pixel, draw with `fillRect`, and keep `g.imageSmoothingEnabled = false`. Avoid antialiased paths, arcs, text and strokes, which blur at this size; draw ellipses, lines and lettering a row of pixels at a time instead (a tiny 3×5 bitmap font is plenty for a few words).
- Use a limited palette of 20 to 40 hand-picked colours, with darker and lighter shades of each, an outline or shadow colour for figures, and dithering (`bayer`) instead of smooth gradients for skies and glows.
- The picture is small: a figure is 20 to 50 pixels tall, a face is a handful of pixels, so make shapes bold and readable and give the main characters clear silhouettes against the background.
- Draw anything that doesn't move once into an offscreen canvas (`document.createElement('canvas')`) and copy it each frame with `drawImage`. Keep `frame` fast: no more than a few thousand `fillRect` calls.
- Never call `Math.random()` in the drawing itself, or the picture flickers. Use a fixed hash of an index for scattered detail such as stars, wood grain and straw, and keep `Math.random()` for spawning particles.
- Draw from back to front: sky and walls, scenery, figures, the foreground, then particles and speech bubbles.

Write the scene for the score below, as I describe it. If I haven't described one, invent a scene that fits the music's mood and title.