Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

give every built-in song the piano-roll view, not just 500 Miles

[._.]/ Adam Eivyfcabf5b0709a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index d4b07904e0..4820760d63 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -18,6 +18,8 @@
## Fixed
+- **Every built-in song gets the layered player + piano-roll view, not just 500 Miles** — the Songs editor's Staff↔Piano (Synthesia-style falling-note) toggle and the multi-part MIDI player only appeared once a song had two or more sheet-music parts, and only "500 Miles" shipped a harmony stack — so the four built-in rounds (Hey Ho Nobody Home, Ah Poor Bird, Rose Rose Rose Red, Zum Gali Gali) showed a bare staff with no piano view. Two changes fix it: (1) the sheet-music card now routes *every* song with notation through the layered player, so a single-part song still gets the piano view (its redundant per-part "Layers" checkbox row and staff-picker pills are hidden when there's only one part); and (2) each built-in round now ships a **canonic voice stack** — the round sung against itself, with each voice entering a fixed number of bars late. The voices are *derived* from the melody (whole-bar rests prepended), so they can't drift from the tune, and a migration backfills them onto installs that seeded the rounds before they carried a voice stack (existing user/AI-derived parts are never clobbered). Also fixes song-card titles getting truncated to "Hey H…" / "Ah P…" — the title now claims its row and the artist moved to the metadata line. (`client/src/pages/SongEditor.jsx`, `client/src/pages/Songs.jsx`, `server/services/songs.js`, `scripts/migrations/086-seed-round-harmony-parts.js`)
+
- **Backups no longer fail at the manifest step** — every `POST /api/backup/run` completed the rsync mirror and the `pg_dump`, then crashed with `writeFile is not defined` while writing the snapshot's `manifest.json` (the write used a bare `writeFile` that was never imported). The manifest now writes through the already-imported `atomicWrite` helper, and `generateManifest` gained end-to-end test coverage so a missing import can't silently reappear. (`server/services/backup.js`)
- **Uploaded init/reference images stop duplicating into the gallery on every render** — an uploaded init image (i2i / edit renders) was staged into `data/images`, the very directory the gallery enumerates, so each render dropped a fresh `init-<uuid>.png` copy there and it surfaced as a duplicate "(no prompt)" card alongside the actual output. Init uploads now stage into `data/image-refs` (the sibling dir multi-reference uploads already use — served statically but excluded from the gallery listing), and the Codex i2i path re-anchors through `resolveImageInputPath` so it still finds them. A migration relocates the orphaned staged-upload files prior renders already left in the gallery (moved, not deleted, so they stay reachable as inputs). (`server/services/imageGen/prepareParams.js`, `server/services/imageGen/codex.js`, `scripts/migrations/085-relocate-staged-upload-images-out-of-gallery.js`)
diff --git a/client/src/pages/SongEditor.jsx b/client/src/pages/SongEditor.jsx
index 773e2af742..d38a66445a 100644
--- a/client/src/pages/SongEditor.jsx
+++ b/client/src/pages/SongEditor.jsx
@@ -868,13 +868,14 @@ function ReadView({ song, setField, onRefreshTemplate, refreshing, partnerSongs
}
// Sheet-music card for the read view: the base melody plus any harmony
-// variations. With more than one part it grows a layered MIDI player — a tempo
-// control plus a checkbox per part so you can hear any combination of voices
-// (melody + bass + a harmony, the whole stack, …) sounding together, synthesized
-// in sync by createMultiScorePlayer. A pill row picks which staff is *shown*
-// (independent of what plays), and the playhead lights up on the shown staff when
-// it's one of the parts currently sounding. A single-part song keeps the simple
-// per-staff player. Returns null when there's no music anywhere.
+// variations. Every song that has music gets the layered MIDI player — a tempo
+// control plus the Staff ↔ Piano-roll (Synthesia) view toggle, synthesized in
+// sync by createMultiScorePlayer. With more than one part it also grows a
+// per-part checkbox row (hear any combination of voices) and a pill row that
+// picks which staff is *shown* (independent of what plays); the playhead lights
+// up on the shown staff when it's one of the parts currently sounding. A
+// single-part song hides those multi-part affordances but keeps the piano view.
+// Returns null when there's no music anywhere.
function SheetMusicViewer({ baseScore, scoreParts = [] }) {
const tabs = useMemo(() => {
const out = [];
@@ -888,17 +889,6 @@ function SheetMusicViewer({ baseScore, scoreParts = [] }) {
}, [baseScore, scoreParts]);
if (!tabs.length) return null;
- // Single part: keep the simple per-staff player (its own transport).
- if (tabs.length === 1) {
- return (
- <section className="space-y-2">
- <h2 className="text-sm font-semibold text-white">Sheet music</h2>
- <div className="bg-port-card border border-port-border rounded-lg p-4 overflow-x-auto">
- <ScoreSheet key={tabs[0].key} text={tabs[0].score} />
- </div>
- </section>
- );
- }
return <LayeredSheetMusic tabs={tabs} />;
}
@@ -909,6 +899,7 @@ function SheetMusicViewer({ baseScore, scoreParts = [] }) {
function LayeredSheetMusic({ tabs }) {
const uid = useId();
const tabsKey = tabs.map((t) => t.key).join('|');
+ const multiPart = tabs.length > 1;
// 'staff' = SVG sheet music; 'piano' = Synthesia-style falling-note piano roll.
const [view, setView] = useState('staff');
@@ -1056,7 +1047,9 @@ function LayeredSheetMusic({ tabs }) {
</div>
</div>
- {/* One checkbox per part — the mix that Play sounds. Swatch = piano color. */}
+ {/* One checkbox per part — the mix that Play sounds. Swatch = piano color.
+ A single-part song has nothing to combine, so the row is hidden. */}
+ {multiPart && (
<fieldset className="flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs">
<legend className="sr-only">Parts to play together</legend>
<span className="text-gray-500">Layers:</span>
@@ -1078,10 +1071,13 @@ function LayeredSheetMusic({ tabs }) {
</label>
))}
</fieldset>
+ )}
{view === 'staff' ? (
<>
- {/* Pill row picks which staff is shown (independent of what plays). */}
+ {/* Pill row picks which staff is shown (independent of what plays).
+ With a single part there's nothing to pick between, so it's hidden. */}
+ {multiPart && (
<div className="flex flex-wrap gap-1.5">
{tabs.map((t) => (
<button
@@ -1095,6 +1091,7 @@ function LayeredSheetMusic({ tabs }) {
</button>
))}
</div>
+ )}
<div className="bg-port-card border border-port-border rounded-lg p-4 overflow-x-auto">
<ScoreSheet key={current.key} text={current.score} controls={false} activeNoteIndex={shownActive} />
diff --git a/client/src/pages/Songs.jsx b/client/src/pages/Songs.jsx
index d87e328bed..0aa8aa5d55 100644
--- a/client/src/pages/Songs.jsx
+++ b/client/src/pages/Songs.jsx
@@ -162,8 +162,7 @@ export default function Songs() {
{song.learned
? <CheckCircle2 size={16} className="text-port-success shrink-0" aria-label="Learned" />
: <Circle size={16} className="text-gray-600 shrink-0" aria-label="In progress" />}
- <span className="text-white font-medium truncate">{song.title}</span>
- {song.artist && <span className="text-gray-500 text-sm truncate">· {song.artist}</span>}
+ <span className="flex-1 min-w-0 text-white font-medium truncate" title={song.title}>{song.title}</span>
{song.builtIn && (
<span className="shrink-0 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] uppercase tracking-wide bg-port-accent/10 text-port-accent border border-port-accent/20">
Built-in
@@ -171,6 +170,7 @@ export default function Songs() {
)}
</div>
<div className="flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-gray-500 mt-1 pl-6">
+ {song.artist && <span className="text-gray-400">{song.artist}</span>}
{song.key && <span>Key: {song.key}</span>}
{song.tempo && <span>{song.tempo} BPM</span>}
{shape && <span>{shape}</span>}
diff --git a/scripts/migrations/086-seed-round-harmony-parts.js b/scripts/migrations/086-seed-round-harmony-parts.js
new file mode 100644
index 0000000000..80e974b84a
--- /dev/null
+++ b/scripts/migrations/086-seed-round-harmony-parts.js
@@ -0,0 +1,73 @@
+/**
+ * Backfill the canonic voice stacks (Voice 2 / 3 / 4 — the round sung against
+ * itself) onto the four built-in traditional rounds for installs that seeded the
+ * rounds before they carried a voice stack.
+ *
+ * Background:
+ * `server/services/songs.js#SEED_SONGS` now ships each round (Hey Ho Nobody
+ * Home, Ah Poor Bird, Rose Rose Rose Red, Zum Gali Gali) with its canonic voice
+ * stack (SEED_ROUND_SCORE_PARTS) — the melody entering a fixed number of bars
+ * late per voice. This is what gives every round (not just 500 Miles) the
+ * layered MIDI player + piano-roll view in the editor.
+ *
+ * Fresh installs seed the parts directly. An install that already persisted
+ * data/songs.json keeps its existing round records — which have no `scoreParts`.
+ * This migration adds the shipped parts to a round ONLY when it has none, so a
+ * user who hand-wrote or AI-derived their own parts is never clobbered. The
+ * parts come from the single shipped source (no drift); the user can also pull
+ * the latest bundled content any time via "Refresh from template".
+ *
+ * Fresh installs (no file) are a clean no-op. Re-runs detect parts present and
+ * skip. Mirrors migration 076 (the same backfill for 500 Miles).
+ */
+
+import { readFile, writeFile, stat } from 'fs/promises';
+import { join } from 'path';
+import { SEED_ROUND_SCORE_PARTS } from '../../server/services/songs.js';
+
+const fileExists = (path) => stat(path).then(() => true, (err) => {
+ if (err.code === 'ENOENT') return false;
+ throw err;
+});
+
+export default {
+ async up({ rootDir }) {
+ const path = join(rootDir, 'data', 'songs.json');
+ if (!(await fileExists(path))) {
+ console.log('📦 migration 086: no data/songs.json — fresh install seeds the round parts directly.');
+ return { updated: 0, reason: 'no-file' };
+ }
+
+ const raw = await readFile(path, 'utf-8');
+ let doc;
+ try { doc = JSON.parse(raw); } catch (err) {
+ console.warn(`⚠️ migration 086: data/songs.json is unparseable (${err.message}); skipping.`);
+ return { updated: 0, reason: 'unreadable' };
+ }
+ if (!doc || !Array.isArray(doc.songs)) {
+ return { updated: 0, reason: 'unexpected-shape' };
+ }
+
+ const now = new Date().toISOString();
+ const filled = [];
+ for (const [id, parts] of Object.entries(SEED_ROUND_SCORE_PARTS)) {
+ const song = doc.songs.find((s) => s && s.id === id);
+ if (!song) continue; // round absent (user deleted it)
+ if (Array.isArray(song.scoreParts) && song.scoreParts.length > 0) continue; // user/AI parts — leave alone
+ // Deep-clone the shipped parts so the persisted record can't share
+ // references with the in-memory seed (defensive — the seed is reused).
+ song.scoreParts = parts.map((p) => ({ ...p }));
+ song.updatedAt = now;
+ filled.push(`${song.title || id} (${song.scoreParts.length})`);
+ }
+
+ if (filled.length === 0) {
+ console.log('📦 migration 086: no rounds needed voice parts; nothing to backfill.');
+ return { updated: 0, reason: 'already-applied' };
+ }
+
+ await writeFile(path, JSON.stringify(doc, null, 2) + '\n');
+ console.log(`📦 migration 086: seeded canonic voice parts onto ${filled.length} round(s): ${filled.join(', ')}.`);
+ return { updated: filled.length };
+ },
+};
diff --git a/scripts/migrations/086-seed-round-harmony-parts.test.js b/scripts/migrations/086-seed-round-harmony-parts.test.js
new file mode 100644
index 0000000000..f04a938a4f
--- /dev/null
+++ b/scripts/migrations/086-seed-round-harmony-parts.test.js
@@ -0,0 +1,114 @@
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
+import { mkdtempSync, rmSync, writeFileSync, readFileSync, mkdirSync, existsSync } from 'fs';
+import { tmpdir } from 'os';
+import { join } from 'path';
+
+import migration from './086-seed-round-harmony-parts.js';
+import { SEED_ROUND_SCORE_PARTS, SEED_SONGS } from '../../server/services/songs.js';
+import { parseScore } from '../../client/src/lib/scoreNotation.js';
+
+const writeJson = (path, value) => writeFileSync(path, JSON.stringify(value, null, 2) + '\n');
+const readJson = (path) => JSON.parse(readFileSync(path, 'utf-8'));
+const findSong = (path, id) => readJson(path).songs.find((s) => s.id === id);
+const ROUND_IDS = Object.keys(SEED_ROUND_SCORE_PARTS);
+
+describe('migration 086 — seed round harmony (canon voice) parts', () => {
+ let rootDir;
+ let songsPath;
+
+ beforeEach(() => {
+ rootDir = mkdtempSync(join(tmpdir(), 'migration-086-'));
+ mkdirSync(join(rootDir, 'data'), { recursive: true });
+ songsPath = join(rootDir, 'data', 'songs.json');
+ });
+
+ afterEach(() => {
+ rmSync(rootDir, { recursive: true, force: true });
+ });
+
+ it('every round seed carries its shipped canon voice parts (single source)', () => {
+ for (const id of ROUND_IDS) {
+ const seed = SEED_SONGS.find((s) => s.id === id);
+ expect(seed.scoreParts).toBe(SEED_ROUND_SCORE_PARTS[id]);
+ expect(seed.scoreParts.length).toBeGreaterThan(0);
+ }
+ });
+
+ it('each canon voice is the melody delayed by whole-bar rests and parses cleanly', () => {
+ for (const id of ROUND_IDS) {
+ const song = SEED_SONGS.find((s) => s.id === id);
+ const melodyBars = parseScore(song.score).measures.length;
+ song.scoreParts.forEach((part, i) => {
+ const parsed = parseScore(part.score);
+ expect(parsed.errors).toEqual([]);
+ for (const m of parsed.measures) expect(m.beats).toBe(4);
+ // A canon voice = N leading whole-rest bars + the full melody. Each voice
+ // enters later than the previous, so its bar count strictly increases.
+ const leadingRestBars = parsed.measures.findIndex((m) => m.notes.some((n) => !n.rest));
+ expect(leadingRestBars).toBeGreaterThan(0);
+ expect(parsed.measures.length).toBe(melodyBars + leadingRestBars);
+ if (i > 0) {
+ const prev = parseScore(song.scoreParts[i - 1].score).measures.length;
+ expect(parsed.measures.length).toBeGreaterThan(prev);
+ }
+ });
+ }
+ });
+
+ it('no-ops when data/songs.json is missing (fresh install seeds parts directly)', async () => {
+ const result = await migration.up({ rootDir });
+ expect(result).toEqual({ updated: 0, reason: 'no-file' });
+ expect(existsSync(songsPath)).toBe(false);
+ });
+
+ it('backfills parts onto every round that has none', async () => {
+ writeJson(songsPath, { songs: ROUND_IDS.map((id) => ({ id, title: id })) });
+ const result = await migration.up({ rootDir });
+ expect(result.updated).toBe(ROUND_IDS.length);
+ for (const id of ROUND_IDS) {
+ expect(findSong(songsPath, id).scoreParts).toHaveLength(SEED_ROUND_SCORE_PARTS[id].length);
+ }
+ });
+
+ it('treats an empty scoreParts array as missing and fills it', async () => {
+ writeJson(songsPath, { songs: [{ id: 'seed-ah-poor-bird', scoreParts: [] }] });
+ const result = await migration.up({ rootDir });
+ expect(result.updated).toBe(1);
+ expect(findSong(songsPath, 'seed-ah-poor-bird').scoreParts.length)
+ .toBe(SEED_ROUND_SCORE_PARTS['seed-ah-poor-bird'].length);
+ });
+
+ it('never clobbers a round that already has user/AI-derived parts', async () => {
+ const mine = [{ id: 'mine', label: 'Mine', role: 'voice-2', score: '| D4w |' }];
+ writeJson(songsPath, {
+ songs: [
+ { id: 'seed-hey-ho-nobody-home', scoreParts: mine },
+ { id: 'seed-ah-poor-bird' },
+ ],
+ });
+ const result = await migration.up({ rootDir });
+ // Only Ah Poor Bird (no parts) is filled; Hey Ho's custom parts are untouched.
+ expect(result.updated).toBe(1);
+ expect(findSong(songsPath, 'seed-hey-ho-nobody-home').scoreParts).toEqual(mine);
+ expect(findSong(songsPath, 'seed-ah-poor-bird').scoreParts.length).toBeGreaterThan(0);
+ });
+
+ it('is idempotent across re-runs', async () => {
+ writeJson(songsPath, { songs: ROUND_IDS.map((id) => ({ id })) });
+ await migration.up({ rootDir });
+ const second = await migration.up({ rootDir });
+ expect(second.reason).toBe('already-applied');
+ });
+
+ it('no-ops when no rounds are present (user deleted them)', async () => {
+ writeJson(songsPath, { songs: [{ id: 'song-custom' }] });
+ const result = await migration.up({ rootDir });
+ expect(result).toEqual({ updated: 0, reason: 'already-applied' });
+ });
+
+ it('skips an unparseable songs.json instead of throwing', async () => {
+ writeFileSync(songsPath, '{ not json');
+ const result = await migration.up({ rootDir });
+ expect(result).toEqual({ updated: 0, reason: 'unreadable' });
+ });
+});
diff --git a/server/services/songs.js b/server/services/songs.js
index 28e1d8883e..8cbbb45a42 100644
--- a/server/services/songs.js
+++ b/server/services/songs.js
@@ -430,6 +430,122 @@ export const SEED_500_MILES_SCORE_PARTS = [
},
];
+// --- Traditional rounds: melodies + canonic voice stacks --------------------
+// The four built-in rounds are canons — the harmony IS the melody sung against
+// itself, each voice entering a fixed number of bars late. Rather than hand-
+// transcribe the staggered voices (which could drift from the tune), we DERIVE
+// each canon voice from the one melody string below: every voice is provably the
+// same melody, just delayed by whole-bar rests. SEED_SONGS uses these for both a
+// round's base `score` and its `scoreParts`, and migration 086 backfills the
+// parts onto installs that seeded the rounds before they carried a voice stack.
+
+// Split a lead-sheet score into its header lines (`key: value`, no bar) and its
+// music-body lines (everything containing a `|`). Blank lines are dropped.
+const splitScoreLines = (score) => {
+ const headers = [];
+ const body = [];
+ for (const raw of String(score).split('\n')) {
+ const line = raw.trim();
+ if (!line) continue;
+ if (!line.includes('|') && /^[A-Za-z]+\s*:/.test(line)) headers.push(line);
+ else body.push(line);
+ }
+ return { headers, body };
+};
+
+// A canon voice: the melody entering `delayBars` whole-bar rests late (the
+// round's staggered entry). Built from the melody so the voice can't drift from
+// the tune. `role` is free-text (`voice-2` …) — it falls after the named harmony
+// stack via harmonyPartOrder (→ 99, stable), so the View switcher lists the
+// voices in entry order after the Melody tab.
+const canonVoice = (melody, { delayBars, id, label, role }) => {
+ const { headers, body } = splitScoreLines(melody);
+ const rests = Array.from({ length: delayBars }, () => '| rw |');
+ return { id, label, role, score: [...headers, '', ...rests, ...body].join('\n') };
+};
+
+// Hey Ho Nobody Home — six bars, three 2-bar phrases. The classic 3-voice round:
+// voices enter one phrase (2 bars) apart, and the three phrases stack into the
+// full minor chord.
+const HEY_HO_MELODY = [
+ 'clef: treble',
+ 'key: C',
+ 'time: 4/4',
+ 'tempo: 76',
+ '',
+ '| G4h(Hey) D4h(ho) | G4q(no-) G4e(bo-) G4e(dy) D4h(home) |',
+ '| G4q(Meat) G4q(nor) A4q(drink) A4q(nor) | B4e(mon-) B4e(ey) B4e(have) B4e(I) A4h(none) |',
+ '| D5q(Still) C5q(I) D5q(will) C5q(be) | B4h(mer-) A4h(ry) |',
+].join('\n');
+const HEY_HO_SCORE_PARTS = [
+ canonVoice(HEY_HO_MELODY, { delayBars: 2, id: 'part-heyho-v2', label: 'Voice 2', role: 'voice-2' }),
+ canonVoice(HEY_HO_MELODY, { delayBars: 4, id: 'part-heyho-v3', label: 'Voice 3', role: 'voice-3' }),
+];
+
+// Ah Poor Bird — eight bars, four 2-bar phrases. A 4-voice round; voices enter
+// every two bars.
+const AH_POOR_BIRD_MELODY = [
+ 'clef: treble',
+ 'key: C',
+ 'time: 4/4',
+ 'tempo: 72',
+ '',
+ '| D4h(Ah) E4h(poor) | F4w(bird) |',
+ '| F4h(take) G4h(thy) | A4w(flight) |',
+ '| A4q(far) D5q(a-) D5q(bove) C5q(the) | D5h(sor-) A4q(rows) G4q(of) |',
+ '| F4h(this) E4h(sad) | D4w(night) |',
+].join('\n');
+const AH_POOR_BIRD_SCORE_PARTS = [
+ canonVoice(AH_POOR_BIRD_MELODY, { delayBars: 2, id: 'part-ahpoorbird-v2', label: 'Voice 2', role: 'voice-2' }),
+ canonVoice(AH_POOR_BIRD_MELODY, { delayBars: 4, id: 'part-ahpoorbird-v3', label: 'Voice 3', role: 'voice-3' }),
+ canonVoice(AH_POOR_BIRD_MELODY, { delayBars: 6, id: 'part-ahpoorbird-v4', label: 'Voice 4', role: 'voice-4' }),
+];
+
+// Rose Rose Rose Red — eight bars, four 2-bar phrases. A 4-voice round; voices
+// enter every two bars.
+const ROSE_MELODY = [
+ 'clef: treble',
+ 'key: C',
+ 'time: 4/4',
+ 'tempo: 76',
+ '',
+ '| D4h(Rose) C4h(rose) | D4h(rose) A3h(red) |',
+ '| D4q(Will) D4q(I) E4q(ev-) E4q(er) | F4q(see) G4q(thee) E4h(wed) |',
+ '| A4q(I) A4q(will) G4q(mar-) A4q(ry) | F4q(at) G4e(thy) F4e E4q(will) A3q(sir) |',
+ '| D4h(At) C4q(thy) E4q(will) | D4w |',
+].join('\n');
+const ROSE_SCORE_PARTS = [
+ canonVoice(ROSE_MELODY, { delayBars: 2, id: 'part-rose-v2', label: 'Voice 2', role: 'voice-2' }),
+ canonVoice(ROSE_MELODY, { delayBars: 4, id: 'part-rose-v3', label: 'Voice 3', role: 'voice-3' }),
+ canonVoice(ROSE_MELODY, { delayBars: 6, id: 'part-rose-v4', label: 'Voice 4', role: 'voice-4' }),
+];
+
+// Zum Gali Gali — the 2-bar chant stated twice. Because the chant repeats every
+// two bars, an even delay would only double the voice in unison; a ONE-bar entry
+// offsets the busy half against the resolving half so the two halves overlap
+// into harmony (a single canonic Voice 2).
+const ZUM_MELODY = [
+ 'clef: treble',
+ 'key: C',
+ 'time: 4/4',
+ 'tempo: 112',
+ '',
+ '| D4q(Zoom) D4e(gul-) E4e(ly) F4e(gul-) E4e(ly) F4e(gul-) E4e(ly) | D4q(zoom) D4e(gul-) D4e(ly) A3q(gul-) C4q(ly) |',
+ '| D4q(Zoom) D4e(gul-) E4e(ly) F4e(gul-) E4e(ly) F4e(gul-) E4e(ly) | D4q(zoom) D4e(gul-) D4e(ly) A3q(gul-) C4q(ly) |',
+].join('\n');
+const ZUM_SCORE_PARTS = [
+ canonVoice(ZUM_MELODY, { delayBars: 1, id: 'part-zum-v2', label: 'Voice 2', role: 'voice-2' }),
+];
+
+// The canonic voice stacks for the four rounds, keyed by song id. Shared by
+// SEED_SONGS (below) and migration 086 so there's ONE source — no drift.
+export const SEED_ROUND_SCORE_PARTS = {
+ 'seed-hey-ho-nobody-home': HEY_HO_SCORE_PARTS,
+ 'seed-ah-poor-bird': AH_POOR_BIRD_SCORE_PARTS,
+ 'seed-rose-rose-rose-red': ROSE_SCORE_PARTS,
+ 'seed-zum-gali-gali': ZUM_SCORE_PARTS,
+};
+
// Seeded on first read so a fresh install opens on a worked example — the song
// the feature was designed around. Mirrors the dirge `slow-4-4` rhythm shape
// and the foundation-first layer ladder from songCraft.js.
@@ -552,16 +668,12 @@ export const SEED_SONGS = [
tempo: 76,
rhythmShapeId: 'slow-4-4',
notation: 'A round in up to six voices (Ravenscroft\'s Pammelia, 1609). New voices enter one two-bar phrase behind the last. Scored in D with no key signature — D Dorian, B natural. Melody after Jack Campin\'s D-minor round transcription.',
- score: [
- 'clef: treble',
- 'key: C',
- 'time: 4/4',
- 'tempo: 76',
- '',
- '| G4h(Hey) D4h(ho) | G4q(no-) G4e(bo-) G4e(dy) D4h(home) |',
- '| G4q(Meat) G4q(nor) A4q(drink) A4q(nor) | B4e(mon-) B4e(ey) B4e(have) B4e(I) A4h(none) |',
- '| D5q(Still) C5q(I) D5q(will) C5q(be) | B4h(mer-) A4h(ry) |',
- ].join('\n'),
+ score: HEY_HO_MELODY,
+ // Canonic voice stack: the melody entering one phrase (2 bars) late per voice
+ // — the round sung against itself. Derived from HEY_HO_MELODY so it can't
+ // drift from the tune. Gives every round (not just 500 Miles) the layered
+ // player + piano-roll view in the editor.
+ scoreParts: HEY_HO_SCORE_PARTS,
notes: 'One of the oldest English rounds. Sung with Ah Poor Bird and Rose Rose Rose Red it forms a classic three-round quodlibet — all three share one minor chord cycle and can be sung at the same time. Keep it light and lilting despite the minor key.',
learned: false,
sections: [
@@ -586,17 +698,10 @@ export const SEED_SONGS = [
tempo: 72,
rhythmShapeId: 'slow-4-4',
notation: 'A four-phrase round (8 bars). Voices enter every two bars. The melody climbs the minor scale to a leap in the third phrase, then settles back to the tonic. Scored in D minor with no key signature (all naturals).',
- score: [
- 'clef: treble',
- 'key: C',
- 'time: 4/4',
- 'tempo: 72',
- '',
- '| D4h(Ah) E4h(poor) | F4w(bird) |',
- '| F4h(take) G4h(thy) | A4w(flight) |',
- '| A4q(far) D5q(a-) D5q(bove) C5q(the) | D5h(sor-) A4q(rows) G4q(of) |',
- '| F4h(this) E4h(sad) | D4w(night) |',
- ].join('\n'),
+ score: AH_POOR_BIRD_MELODY,
+ // Canonic voice stack: the melody entering two bars late per voice. Derived
+ // from AH_POOR_BIRD_MELODY so it can't drift from the tune.
+ scoreParts: AH_POOR_BIRD_SCORE_PARTS,
notes: 'A gentle English lament-round. Combines with Hey Ho Nobody Home and Rose Rose Rose Red as a quodlibet. Two lyric sets ship: the common "take thy flight" verse and the "Oh poor bird, why art thou…" variant.',
learned: false,
sections: [
@@ -622,17 +727,10 @@ export const SEED_SONGS = [
tempo: 76,
rhythmShapeId: 'slow-4-4',
notation: 'A four-phrase English round (i–VII–V harmony), 8 bars. Voices enter every two bars. Scored in D minor with no key signature (all naturals).',
- score: [
- 'clef: treble',
- 'key: C',
- 'time: 4/4',
- 'tempo: 76',
- '',
- '| D4h(Rose) C4h(rose) | D4h(rose) A3h(red) |',
- '| D4q(Will) D4q(I) E4q(ev-) E4q(er) | F4q(see) G4q(thee) E4h(wed) |',
- '| A4q(I) A4q(will) G4q(mar-) A4q(ry) | F4q(at) G4e(thy) F4e E4q(will) A3q(sir) |',
- '| D4h(At) C4q(thy) E4q(will) | D4w |',
- ].join('\n'),
+ score: ROSE_MELODY,
+ // Canonic voice stack: the melody entering two bars late per voice. Derived
+ // from ROSE_MELODY so it can't drift from the tune.
+ scoreParts: ROSE_SCORE_PARTS,
notes: 'The third of the classic quodlibet trio with Hey Ho Nobody Home and Ah Poor Bird — all three stack in the same key. A favourite singing-round.',
learned: false,
sections: [
@@ -657,15 +755,11 @@ export const SEED_SONGS = [
tempo: 112,
rhythmShapeId: 'driving-4-4',
notation: 'The refrain chant, repeated. Scored in D minor with no key signature (all naturals). Loop it as many times as you like; a second voice entering one phrase behind turns it into a round.',
- score: [
- 'clef: treble',
- 'key: C',
- 'time: 4/4',
- 'tempo: 112',
- '',
- '| D4q(Zoom) D4e(gul-) E4e(ly) F4e(gul-) E4e(ly) F4e(gul-) E4e(ly) | D4q(zoom) D4e(gul-) D4e(ly) A3q(gul-) C4q(ly) |',
- '| D4q(Zoom) D4e(gul-) E4e(ly) F4e(gul-) E4e(ly) F4e(gul-) E4e(ly) | D4q(zoom) D4e(gul-) D4e(ly) A3q(gul-) C4q(ly) |',
- ].join('\n'),
+ score: ZUM_MELODY,
+ // Canonic Voice 2: the chant entering ONE bar late so its busy half overlaps
+ // the resolving half (an even delay would only double it in unison). Derived
+ // from ZUM_MELODY so it can't drift from the tune.
+ scoreParts: ZUM_SCORE_PARTS,
notes: 'A simple chant on repeat — sung here as "zoom gully gully gully, zoom gully gully" (the refrain of the Israeli round Zum Gali Gali). Loop it as a driving ostinato; a second voice entering a phrase late turns it into a round. Shares the key with the English trio and rounds out the set.',
learned: false,
sections: [