Expand Lumen stories and add island postcards

This commit is contained in:
Hadrian Burkhardt
2026-11-13 10:18:42 +01:00
parent 7e6b203a02
commit abaab927d9
211 changed files with 10839 additions and 7278 deletions
+80 -23
View File
@@ -1,37 +1,94 @@
# Bundled diary readings and guiding narration
# Mara’s notebook: directed Qwen narration
Twenty-eight fixed recordings accompany the story. Mara’s five original diary readings use `bf_emma` (British female); twenty-three guiding passages use a distinct `bm_george` narrator (British male). These are **synthetic recordings rendered during development**, not human voice-actor recordings. The app plays bundled files through just_audio, with no speech model, Android reader, runtime synthesis or download. The original PCM takes remain unchanged as prefixes of the expanded masters. Twenty-four recordings now append the complete new story passages in the narrator voice; the other four recordings remain unchanged.
The lighthouse story has 28 complete readings, rewritten for spoken delivery in
`STORY.md`. Mara's letters and memories use an affectionate older British voice;
the present-day narrator uses a warm, conversational British male voice. Mara
also speaks her own dialogue at the tower. The crossing, the clockwork beacon,
and the return over the exposed causeway form one continuous journey.
- `scripts.json`: canonical scripts with stable IDs, speaker, voice and rendering speed. Each complete script matches the displayed original text plus its continuation. Expanded records retain `baseText`, `continuation` and `continuationSpeaker`; the renderer records the original frame count and PCM checksum. The window and match memory keep Mara’s diary take, then switch to the narrator for the added present-day action.
- `wav/`: reviewable 24 kHz mono PCM16 WAV masters.
- `manifest.json`: model/voice checksums, generator versions, exact scripts, passage timings and WAV and FLAC checksums.
- `assets/audio/narration_*.wav`: bundled PCM16 copies, byte-identical to the WAV masters.
- `assets/audio/narration_*.flac`: archival lossless exports, excluded from the APK.
- `licenses/`: Kokoro ONNX wrapper MIT and model Apache 2.0 licenses.
These are synthetic recordings generated offline with
[Qwen3-TTS 1.7B VoiceDesign](https://huggingface.co/Qwen/Qwen3-TTS-12Hz-1.7B-VoiceDesign).
They replace the former Kokoro recordings in full. The app plays bundled mono
24 kHz PCM16 WAVs; it does not load a speech model or download audio.
Mara uses generation speed 0.82 and the narrator 0.88, with short fades, paragraph pauses and peak normalization. The in-app speed control changes playback speed without changing pitch. Pausing preserves the actual recording position; leaving a page releases playback. Readings autoplay 3 seconds after opening a narrated page. Page turns, backgrounding, Play, Pause and Stop cancel the pending start. Folded notes wait until unfolded.
## Authoring and performance
## Regeneration
- `STORY.md`: the editable manuscript, using the existing 28 page IDs. The
`<!-- Narrator -->` marker separates Mara's letter from present-day narration
on the window and match-memory pages. It is never displayed or spoken.
- `cast.json`: stable descriptions of Mara and the narrator.
- `performance.json`: pinned model revision and acting direction for each scene.
- `scripts.json`: compiled exact text, cast segments and editorial pauses.
- `manifest.json`: scripts, actual model instructions, timed cues, source and
audio checksums, model revision, runtime versions and rendering settings.
- `wav/`: reviewable PCM16 masters.
- `assets/audio/narration_*.wav`: byte-identical bundled copies.
- `assets/audio/narration_*.flac`: lossless archives, excluded from the app bundle.
- `licenses/QWEN3_TTS_APACHE_2.txt`: Qwen model/code licence. The old Kokoro
licences remain available for historical provenance.
Generator: [kokoro-onnx](https://github.com/thewh1teagle/kokoro-onnx). Model and voice data: `kokoro-v1.0.onnx` and `voices-v1.0.bin` from its [model-files-v1.0 release](https://github.com/thewh1teagle/kokoro-onnx/releases/tag/model-files-v1.0). See the upstream [voice guide](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md).
The compiler preserves puzzle grids, clues, artwork links, page IDs and save
keys. The five letter/memory pages keep Mara as their lead speaker. The other
pages use the narrator, switching to Mara for her quoted speech. Connected
passages are grouped into takes of up to 90 words. Each take receives the voice
description and scene direction through VoiceDesign's `instruct` parameter;
only manuscript text goes into the speech input.
Use Python 3.12, dependencies pinned in `requirements.txt` and ffmpeg. Keep model data outside the app project. Edit the canonical `scripts.json` text before regenerating:
Descriptions and seeds encourage continuity but cannot guarantee identical
voice timbre across independent generations. Listen for pronunciation, voice
drift and added or omitted words. Automated transcription is a review aid,
not a verified transcript or a substitute for listening.
## Regenerate and verify
Use the existing isolated Qwen runtime described in `docs/voice-audition.md`.
On this host the RX 6800 requires access to `/dev/kfd` and `/dev/dri`, outside
the restricted command sandbox. The model is already cached locally.
```sh
python scripts/render_narration.py --model /path/to/kokoro-v1.0.onnx --voices /path/to/voices-v1.0.bin
# Append new narrator passages while preserving existing PCM takes:
python scripts/render_narration.py --model /path/to/kokoro-v1.0.onnx --voices /path/to/voices-v1.0.bin --append-continuations
python3 scripts/check_narration_assets.py
# Regenerate only guiding narration, preserving Mara’s existing takes:
python scripts/render_narration.py --model /path/to/kokoro-v1.0.onnx --voices /path/to/voices-v1.0.bin --speaker Narrator
python3 tool/compile_mara_story.py
HF_HOME="$PWD/artifacts/voice-audition/model-cache" \
artifacts/voice-audition/runtime/rocm/bin/python \
scripts/render_qwen_narration.py --story-root assets --flac-dir assets/audio \
--device cuda --offline --batch-size 4 --attention sdpa \
--work artifacts/mara-qwen
HF_HOME="$PWD/artifacts/voice-audition/model-cache" \
artifacts/voice-audition/runtime/rocm/bin/python \
scripts/review_qwen_narration.py --work artifacts/mara-qwen
```
The check requires only Python’s standard library and ffmpeg. It verifies script freshness, cue coverage, master format, checksums and runtime WAV/master equality and bit-identical WAV/FLAC decoding. It also rejects Flutter device-reader imports in app code. Listen to new takes before accepting them; automated checks cannot judge performance or pronunciation.
Add `--publish` to the render command to replace the local bundled assets after
staging. Initial Qwen publication requires all 28 readings. Raw takes are cached
by their text, instructions, model revision, settings, batch and seed; rerunning
uses matching takes and regenerates changed content. `--retake <page-id>:<index>`
uses a new seed for a specific segment (indices start at 1), saved in the work
directory. Keep the same work directory, attention mode and batch size when
resuming. Batched retakes regenerate the other members of their batch as well.
A future actor recording can replace the masters and bundled assets while preserving stable page IDs. Update passage timings and checksums with that recording; never silently change the written script to fit audio.
```sh
python3 scripts/check_narration_assets.py
python3 scripts/render_mara_previews.py
artifacts/voice-audition/runtime/rocm/bin/python scripts/test_qwen_narration.py
flutter analyze --no-pub
flutter test --no-pub
```
Playback uses PCM WAV because the connected Huawei API 26 tablet advanced the FLAC clock without creating an AudioTrack. WAV produces an active, unmuted 24 kHz mono PCM media track through the speaker, and the user confirmed audible speech. The release smoke test now checks that mixer track, in addition to pause/resume and elapsed time.
The preview exporter writes three atmosphere mixes to
`artifacts/mara-qwen/listening/` and a full-story playlist to
`artifacts/mara-qwen/listen.m3u`.
The checker verifies displayed text, cast and instructions, cue coverage, PCM
format and levels, checksums and bit-identical WAV/FLAC decoding. The earlier
PCM-prefix preservation checks no longer apply because the whole story has
been rewritten and re-recorded. `baseText` and `continuation` on the two mixed
pages describe their text and speaker boundary, not an old recording prefix.
The seven cottage narrator recordings cover the lantern/key/compass entries and memories and the closing threshold leaf. Sixteen more cover the before/after passages for campaign levels 4–11. Puzzle instruction leaves remain unvoiced. On-screen labels distinguish “Mara · diary reading” from “Narrator · recorded story”; playback starts after a 3-second page delay and stops on navigation or backgrounding. Cue highlighting follows both displayed passages. One Play/Pause/Resume/Replay control covers the whole page, and the speaker label follows per-cue voice changes. Original PCM-prefix hashes are checked alongside full-track checksums.
Playback still supports autoplay after three seconds, pause/resume, stop,
replay, speed and passage highlighting. Folded notes wait until unfolded;
page turns and backgrounding stop playback. One control plays the complete
reading, with the live speaker label following its cues. Atmosphere remains a
separate layer that ducks beneath speech. Puzzle instruction leaves are unvoiced.
No device installation is part of this revision. Future tablet playtests must
follow the root `AGENTS.md` fresh-install policy. Previous native Kokoro playback
results do not constitute a device listening check of these new Qwen recordings.