Notes could only be played one at a time, by a key or a behavior. A
pattern is a stretch of notes for one instrument, drawn in a piano
roll and played in time through the scheduler of #332. Songs (#334)
will lay patterns out on tracks.
- New asset type pattern under the heading Patterns. Instruments are
listed under Instruments now, since a heading is one per type.
- Notes are a start and a length in ticks, a note number and a
velocity, kept to their rules on load and in every command. The
instrument, the length in bars, the grid, the meter and the tempo
are rows in the inspector. The loop is the asset's own data, the
whole pattern while none is set.
- Grids from 1/1 to 1/32 and the triplets 1/4T to 1/32T, all whole
ticks. The meter only moves the bar lines, the notes stay put.
- The tab shows the keys down the left, a ruler with bars, beats,
loop and start along the top, the notes between them and a
velocity lane below. Keys the instrument plays nothing for are
grey, the names of a drum kit stand on its keys.
- A click draws a note on the grid line before the pointer, as long
as the last one drawn or lengthened and as hard as the last
velocity set. The body moves a note, the right end lengthens it,
Alt leaves the grid. A drag on empty grid picks with a band, Shift
adds, a right-click deletes.
- Keys: Space plays, Delete, Ctrl+C/V/D/A, the arrows by a semitone
or a grid step and with Shift by an octave or a bar. A paste lands
where playing starts. Every gesture is one undo step.
- A click on the ruler sets where playing starts, a drag the loop or
one of its ends, its menu loops a bar or the whole pattern.
- The wheel scrolls, Shift across, on the ruler or with Alt it zooms.
Ctrl+wheel stays with the browser, Pixi listens passively.
- Play runs the loop through the scheduler. An edit goes to it on
the next window without a restart, a new loop or tempo counts from
what is planned. Another pattern shown or a project opened stops it.
- The time axis and the ruler are their own pieces in editor/music
for the song tab. The rules of the roll are pure functions in
rollView and rollEdit.
Findings:
- Music.play could start after a stop that came while it was still
loading its files. A run counter makes the late start give up.
Music.edit now loads what a new note needs as well.
- A click on an end of the loop would have set the loop again. A
press there only moves the end once it is dragged.
Tests:
- pattern.test.ts (new, 9) and piano-roll.test.ts (new, 16): model,
grids, meter, held notes, sequence, commands, loop, round trip,
drum names, time lines, rows, hits, bands, lane, edit rules.
- e2e 64 (new) on melektaus-atx: ALL PASSED, 20 checks. e2e 4 with
29 asset types: ALL PASSED, 62 checks.
- Gate on melektaus-atx: CHECK EXIT 0, 247 test files, 3839 tests.
- Counter-checks: the move without its clamp, the sequence without
the end of the pattern, the duplicate offset without whole grid
steps each fail 1 test. Without passing edits to the scheduler the
e2e check for a note drawn while playing fails, the rest passes.
- Probe on stein2: the tab with a drum kit, before and while playing,
looked at in two screenshots.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>