Commit eb3a4b7
Add <Score>: embedded Verovio notation with synced playback
Drops MEI-authored music into essays via <Score slug="..." />:
- MEI is rendered by Verovio (WASM, lazy-loaded on first score in view).
Layer stack: dedicated staff-lines at stage-level (single source, no
double-stroke), scrolling pan with music, frozen clef/keysig/meter
overlay pinned to the left, playhead, hint.
- Fixed playhead; pan translates. Notes/chord-symbols/functional labels
glow via a feathered drop-shadow while sounding (render loop diffs
`is-active` sets per frame, gated on playing to keep scrub cheap).
- Pre-roll: static rest frame already shows the pre-play pose so the
first note starts right of the playhead and scrolls in with no jump
when audio begins.
- Loop mode: 3 SVG copies tile via negative margin-left; translate-wrap
is invisible; gated against firing during pre-roll.
- Non-loop tail: silent post-audio scroll so the last note walks off
before reaching the end state.
- Drag to seek (pointer capture + threshold), click to toggle, click at
end → fade-to-start via opacity transition. backdrop-filter suspended
while dragging to avoid stutter from per-frame backdrop re-sampling.
- Right-edge entrance: stage mask fades staff lines in first, a wider
pan-mask fades the notes in later, and a backdrop-filter blur overlay
sharpens them as they scroll inward.
Deps: @astrojs/mdx (so essays that embed a <Score> can live as .mdx),
verovio (WASM toolkit, ~1.5MB gzipped, on-demand).
Test content: public/scores/twinkle (no-loop, 8 bars with jazz chord
symbols + functional analysis) and public/scores/ii-V-I (looping 2-bar
cadence). Demo essay: score-test.mdx.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ef38f27 commit eb3a4b7
8 files changed
Lines changed: 2509 additions & 19 deletions
File tree
- public/scores
- ii-V-I
- twinkle
- src
- components
- content/essays
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
0 commit comments