# INTEGRATION-cycle-5 — From AMT to "personal publishing company"

> **Status:** This is the **persisted delta** for the 2026-08-08 cycle-5 sweep.
> Cycle-1 → cycle-4: built the AMT × LLM/agent/foundation-model monitor. The pipeline was audio → stems → AMT → MIDI → music21 → Verovio. The dashboard surfaced arXiv, GitHub, assets, and links. The demo included a tester, a transcriber app, a multi-device audio configurator, and the AMT-demo + LH-prompt.
> **Cycle-5 is the scope expansion.** The user said: *"not only looking for Music transcription monitor but also for a way of Publishing music creating lead sheets preparing MEI files standardizing the engraving of the music actually having a very personal approach like a personal Publishing company for Music."*
>
> The cycle-5 sweep turned that brief into 13 concrete open-source tools. None of them replace the AMT pipeline — they sit on top of it. The publishing pipeline re-uses music21 + Verovio from the AMT pipeline and adds Sheet Sage, VeeHarmGen, BACHI, LilyPond, OpenSheetMusicDisplay, Django-Music-Publisher, and musicmetadata/cwr2. Result: a minimum viable personal publishing company on a single laptop, all open-source.

---

## 1. TL;DR

- **The AMT pipeline from cycle-1 → cycle-4 is unchanged.** Demucs, Basic Pitch, MuScriptor, MIROS, music21, Verovio, OSMD — all still the right call. No removals.
- **Cycle-5 adds 13 new entries.** 4 in lead-sheet generation, 3 in engraving, 4 in music-publishing admin / metadata, 3 in music generation.
- **The LH-prompt demo (Part B) is extended with 3 new outputs** for the personal-publishing theme: **Lead sheet prompt**, **Engraving spec**, **MEI prep checklist**. Total outputs go from 6 → 9. The 6 existing outputs (horizontal/vertical/square video, audio, music, social) are unchanged.
- **The "personal publishing company" stack is free, license-clean, and offline-runnable** on a single laptop: Sheet Sage + VeeHarmGen + music21 + LilyPond + OSMD + DMP + cwr2. All open-source. No SaaS fees.
- **One watchlist removal** for the LH-prompt: the audio-sweep-style card on `index.html` no longer needs a duplicate — the cycle-5 demo card carries the new outputs.

---

## 2. The three pipelines, side by side (cycle-5)

```
PIPELINE A — "AMT-first" (carried from cycle-1, unchanged)
═══════════════════════════════════════════════════════════
  audio (any)
    ↓
  Demucs / MelBand-RoFormer — source separation
    ↓
  MuScriptor (full-mix AMT) OR Basic Pitch (per-stem)
    ↓
  music21 — cleanup, key/time inference, quantize, MusicXML round-trip
    ↓
  Verovio — engraving → SVG / PDF
    ↓
  MusicXML / MIDI / SVG export
  License posture:  Apache 2.0 / MIT / LGPL  ✓ commercial-clean stack exists


PIPELINE B — "Lead-sheet-first" (NEW for cycle-5)
═══════════════════════════════════════════════════════════
  audio (pop / rock / folk / worship / fake-book)
    ↓
  Sheet Sage — melody + chord symbols
    ↓
  VeeHarmGen — chord re-voicing (optional)
    ↓
  BACHI — chord recognition (alternative path from audio)
    ↓
  music21 — cleanup, key inference, MusicXML round-trip
    ↓
  LilyPond — engraving → PDF (the "personal publishing" feel)
    OR Verovio — engraving → SVG (faster, browser-friendly)
    ↓
  OpenSheetMusicDisplay — browser preview
    ↓
  Django-Music-Publisher — metadata catalog
  musicmetadata/cwr2 — CWR 2.1/2.2 generation → CMO registration
  License posture:  GPL (LilyPond) + BSD-3 (OSMD) + MIT (DMP, cwr2)
                    + CC BY-NC-SA 3.0 (Sheet Sage)  ⚠ swap for Basic Pitch if commercial


PIPELINE C — "Generation-first" (NEW for cycle-5)
═══════════════════════════════════════════════════════════
  idea / lyrics
    ↓
  ACE-Step v1.5 (Apache 2.0, 8 GB VRAM) — budget default
  OR YuE (Apache 2.0, 16 GB VRAM) — high quality
  OR DiffRhythm 2 (Apache 2.0, long form) — long-form songs
  OR Stable Audio 3.0 (commercial-safe) — client demo
    ↓
  (optional) Sheet Sage — extract lead sheet from generated audio
    ↓
  Pipeline B — engrave + register
  License posture:  Apache 2.0 / MIT / Stability Community  ✓ mostly clean
```

**Convergence:** Pipelines B and C both end at the same publishing admin (DMP + cwr2). Pipeline A can also be re-routed into Pipeline B if you want to turn a piano reduction into a lead sheet.

---

## 3. What changed in the demo (cycle-5)

The existing `demo/` directory from cycle-4 already satisfies the Long Horizon Prompt spec. Cycle-5 **adds** three new outputs to the prompt-templating engine — all for the personal-publishing theme:

| New output | Format | Use it for |
|---|---|---|
| **Lead sheet prompt** | LilyPond / Sheet Sage / Verovio brief | Type a melody idea, get the LilyPond layout, key signature, chord chart, and lyrics block to drop into Sheet Sage or write a `.ly` file directly. |
| **Engraving spec** | Type-setting rules + page layout | Page size, margins, font (LilyPond: `emmentaler` / `haydn` / `ross` / `brave`), stem direction, hairpin style, system spacing, rehearsal marks. |
| **MEI prep checklist** | MusicXML / MEI validation | Headers, work title, movement title, composer, lyricist, encoding date, source, rights, file naming convention, MEI schema version, validation tool. |

The 6 existing outputs (horizontal / vertical / square video, audio, music production, social) are unchanged. Total outputs go from **6 → 9**.

**File map after cycle-5:**

```
demo/
├── index.html       # 3 new prompt-output cards added (lh-out-lead-sheet, lh-out-engraving, lh-out-mei-prep)
│                    # + meta paragraph updated (6 → 9) + footer cycle-4 → cycle-5
├── styles.css       # UNCHANGED (the existing card styles handle the new outputs)
├── app.js           # 3 new template functions (promptLeadSheet, promptEngraving, promptMeiPrep)
│                    # + registered in TEMPLATES + toast count 6 → 9
└── README.md        # added §"cycle-5 delta" entry
```

**No code added in cycle-5 for the AMT demo (Part A).** The 4 cycle-4 entries (ACE-Step, Libretto, Rubato, Stable Audio 3.0) + V2N + the cycle-3 winners carried forward are unchanged. Cycle-5 is a *prompt-rotation* cycle for Part B (the LH-prompt tool), not a *new-tool* cycle.

**File map after cycle-5 — Part A additions (the resource cards):**

The resources surfaced in the demo Part A are unchanged from cycle-4. The 4 cycle-4 entries + V2N + carried-forward cycle-3 winners remain the live view. The new cycle-5 entries (Sheet Sage, VeeHarmGen, BACHI, Verovio 6.0, LilyPond, OSMD, DMP, cwr2, DiffRhythm 2, etc.) live in `RESOURCES-cycle-5.md` and are **not** in the demo Part A — the demo Part A is for "what's hot in the AMT space," and the new cycle-5 entries are for the publishing leg, which has its own product surface (the 3 new prompt outputs).

If the user wants the cycle-5 publishing entries surfaced as demo Part A cards, that becomes a cycle-6 task.

---

## 4. What to do next (cycle-6 watchlist)

The cycle-5 sweep surfaced 6 items worth re-checking in cycle-6:

1. **Sheet Sage code maintenance** — last commit 2024, paper Dec 2022. Verify the install still works on a modern Linux + Docker. If it's stale, fork it or use the ChordMiniApp integration as a maintained alternative.
2. **BACHI code + dataset on HF** — ICASSP 2026. Verify the inference script + checkpoints are still hosted. If they get archived, find an alternative chord-recognition SOTA.
3. **Django-Music-Publisher at scale** — the only open-source publishing admin. Verify it handles the MusicBrainz lookup + CWR batch registration in production.
4. **LilyPond 2.28** — watch the dev cycle toward 2.28 for the next round of typographic improvements.
5. **OSMD v1.0** — current line is 0.8.x. Watch for a 1.0 that drops the VexFlow dependency or adds MEI support.
6. **Qwen-Music weights** — paper-only as of Aug 8 2026. When the HF weights drop, test the cover-song mode against cycle-4's ACE-Step.

**Nothing to drop.** All 13 cycle-5 entries are additive. The watchlist removals from cycle-3/4 still hold (omnizart status, MIROS public weights, MuScriptor PyPI, basic-pitch maintenance).

---

## 5. Where to look (file map)

| What | Where |
|---|---|
| **Full categorized list (cycle-5)** | `dashboard/RESOURCES-cycle-5.md` |
| Carried forward (cycle-4) | `dashboard/RESOURCES-cycle-4.md` |
| Carried forward (cycle-3) | `dashboard/RESOURCES-cycle-3.md` |
| Carried forward (cycle-2c) | `dashboard/RESOURCES-delta-cycle-2c.md` |
| Carried forward (audio sweep) | `dashboard/RESOURCES-audio.md` |
| **This cycle's integration note** | `dashboard/INTEGRATION-cycle-5.md` (this file) |
| Carried forward (cycle-4 integration) | `dashboard/INTEGRATION-cycle-4.md` |
| **This cycle's demo refresh** | `dashboard/demo/index.html` (Part B only — 3 new output cards) |
| This cycle's demo README delta | `dashboard/demo/README.md` (cycle-5 section) |
| Cycle-3 demo README (the LH prompt spec) | `dashboard/demo/README.md` §"Part B" |
| Hub card | `dashboard/index.html` (cycle-5 card → demo + RESOURCES-cycle-5.md) |
| Pipeline stage config (to extend) | `setup/pipeline_starter.py` (unchanged this cycle — Sheet Sage path is a future-cycle integration) |
| Trusted packages list (to extend) | `trusted_packages.txt` (no new entries this cycle — Sheet Sage is Docker-based, not pip-installable) |

---

## 6. Stage 2.5 — MIDI-DDSP timbre transfer (cycle-5 post-publication addendum)

**Added 2026-08-09 after the user approved the questionnaire (Stage 2.5, browser demo, MIDI-DDSP).**

### What changed

The pipeline now has a **Stage 2.5** between Stage 2 (AMT, audio → MIDI) and Stage 3 (music21 cleanup):

```
STAGE 2   audio → MIDI  (MuScriptor / Basic Pitch)
            ↓
STAGE 2.5 MIDI → expressive audio in a chosen timbre  (MIDI-DDSP)   ← NEW
            ↓
STAGE 3   MIDI cleanup (music21)
            ↓
STAGE 4   Engraving (Verovio / LilyPond)
            ↓
STAGE 5   Publishing admin (DMP / cwr2)
```

### Files added/modified

| File | Change |
|---|---|
| `dashboard/RESOURCES-cycle-5.md` | New §8 — MIDI-DDSP entry (Apache 2.0, archived Feb 2024, 4 pretrained instruments) |
| `dashboard/INTEGRATION-cycle-5.md` | New §6 — this section |
| `setup/pipeline_starter.py` | New `Stage25DDSP` class + `STAGE_2_5_DDSP` constant + `run_ddsp()` method on the pipeline orchestrator |
| `setup/ddsp_transfer.py` | NEW — the real MIDI-DDSP inference script (Apache 2.0, runs locally with TensorFlow) |
| `trusted_packages.txt` | `midi-ddsp` added with the project-page link + a one-line reason |
| `dashboard/demo-ddsp/index.html` | NEW — the browser-based timbre transfer demo (Web Audio API approximation, no server) |
| `dashboard/demo-ddsp/styles.css` | NEW — extends `../shared/styles.css` |
| `dashboard/demo-ddsp/app.js` | NEW — the timbral transformer logic (4 MIDI-DDSP instrument profiles + WAV export) |
| `dashboard/demo-ddsp/README.md` | NEW — file map + how to run + the relationship to the real MIDI-DDSP |
| `dashboard/index.html` | NEW card pointing at `demo-ddsp/` + `RESOURCES-cycle-5.md` §8 |

### What the browser demo is and isn't

| | Browser demo (`demo-ddsp/`) | Python script (`ddsp_transfer.py`) |
|---|---|---|
| **Engine** | Web Audio API oscillators + filters + envelopes | Real MIDI-DDSP model (TensorFlow) |
| **Instruments** | 4 (violin, flute, sax, trumpet) — approximation | 4 pretrained checkpoints (same 4) |
| **Quality** | "Good enough" preview, audible timbre shift | Real neural synthesis, high quality |
| **Setup** | None — open the HTML in any browser | `pip install midi-ddsp` + download checkpoints |
| **Network** | None — no fetch, no model download, no API | None — local TensorFlow inference |
| **Use it for** | Quick UI demo, shape exploration, no-install preview | Production timbre transfer, final output |

The two paths share the same input (MIDI), same output (WAV), and same instrument names. The browser path is the "no-install first look"; the Python path is the "real production transfer."

### What to do next

The cycle-5 questionnaire left three follow-ups:

1. **MIDI-DDSP weights download** — the pretrained checkpoints (~1.5 GB total for the 4 instruments) are hosted on Google Cloud Storage. Add a `setup/download_ddsp_checkpoints.py` script that fetches them and verifies the SHA-256 hashes against the manifest in the Magenta repo. Cycle-6 task.

2. **MIDI-DDSP inference benchmark** — measure inference latency on a 30-second MIDI input on the project's reference hardware (likely an Apple Silicon Mac). Cycle-6 task — need actual hardware to benchmark.

3. **MIDI-DDSP → music21 → Verovio round-trip test** — take a MIDI in, run it through Stage 2.5 with one instrument, run the rendered WAV back through Stage 2 (MuScriptor or Basic Pitch), verify the recovered MIDI matches the input. Validates the round-trip. Cycle-6 task.

### Nothing to drop

The Stage 2.5 addition is strictly additive. The Stage 1 (Demucs), Stage 2 (MuScriptor / Basic Pitch), Stage 3 (music21), Stage 4 (Verovio), Stage 5 (DMP / cwr2) layers are unchanged. Stage 2.5 is opt-in — the existing pipeline runs unchanged if you skip the timbre-transfer step.
