Files
midi-tools/docs/ARCHITECTURE.md
T
zemion 06e095a2eb
Verify / verify (push) Canceled after 0s
Release MIDI Tools 0.2.0
2026-09-02 09:14:48 +02:00

22 lines
1.5 KiB
Markdown

# Architecture
`core/midi.ts` turns a bounded SMF byte stream into inert tracks and absolute-tick events. Chunk boundaries, four-byte VLQs, running status, event counts, SysEx size, PPQN division and known fixed-length meta events are validated before data is exposed. Editing functions clone this model and preserve stable event ordering.
`Workbench.tsx` keeps the last valid document during failed imports or
operations. Parsing, transforms and exports execute through a disposable module
worker; progress messages are revision-scoped, cancellation terminates the
worker and late messages cannot replace newer state. A no-Worker fallback exists
for test and older-browser resilience, while the shipped browser path stays
off-main. The SVG piano roll renders at most 5,000 notes. Playback maps ticks
through the tempo map, creates fixed application-owned sine oscillators and can
stop immediately by closing the active `AudioContext`; imported bytes never
become code or remote references.
Paired notes can be selected in the SVG piano roll and edited through the same
worker protocol as bulk transforms. Web MIDI access is requested only after an
explicit click, without SysEx permission; scheduled output is bounded and Stop
sends all-notes-off on every channel. The local SoundFont inspector validates
RIFF `sfbk` structure and reports INFO/pdta counts but does not render the bank.
All Vite assets use relative paths for nested portal mounting. Release packaging fixes ZIP ordering, timestamps and permissions.