Migrate Lumen to Dart and Flutter 2.0

This commit is contained in:
Hadrian Burkhardt
2026-10-31 04:08:16 +01:00
parent 07e9253663
commit 302ad6d38e
145 changed files with 5856 additions and 101 deletions
+4
View File
@@ -15,3 +15,7 @@ The earlier `mara-notebook-background-v1.png` and its prompt are preserved for c
`home-harbour-v2.png` and `home-notebook-cover-v2.png` were generated with the built-in image generation tool, using new-image generation with transparent backgrounds. Their exact prompts are preserved in `home-harbour-v2.prompt.txt` and `home-notebook-cover-v2.prompt.txt`. Originals are copied to `drawable-nodpi/home_harbour.png` and `home_notebook_cover.png` for offline use.
The harbour is a soft-edged northern-island watercolour; the closed cover is faded blue linen with heather, repairs and a red ribbon. `HomeArtwork.java` preserves aspect ratio and places a native handwritten label on the cover’s blank paper label. These replace the earlier Canvas harbour and cover on the “A light to come home to” screen. No readable text was generated into either image.
## Flutter migration (2.0)
Flutter bundles the existing originals from this folder directly. `lib/ui/paper.dart` positions content on the single page and overlays native Flutter handwriting on the cover label. `lib/main.dart` displays the harbour, cottage and lantern art. The earlier Android resource paths above now live under `legacy/android/` for reference. No new pictures were generated for the migration.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+144
View File
@@ -0,0 +1,144 @@
{
"tracks": {
"cottage.dedication": {
"pageId": "cottage.dedication",
"resource": "narration_cottage_dedication",
"text": "My dear,\n\nI never could keep a proper diary. I wrote down the tides, the things that needed mending, and whatever I was afraid I might forget.\n\nYou will find a little of all three in here. Take your time. There is no right way to turn these pages.\n\nWith all my love,\nGran",
"file": "narration_cottage_dedication.flac",
"sampleRate": 24000,
"channels": 1,
"frames": 441184,
"durationMs": 18383,
"textSha256": "7ecbea473a70ab48a49861535bf30a3909005ce5735dcd048bc6abe576b1e017",
"flacSha256": "7606f2ea97386ed864155438d2785f6d8e6593fc04d785d432dfceb07bff52b7",
"cues": [
{
"startMs": 180,
"endMs": 9268,
"text": "My dear,\n\nI never could keep a proper diary. I wrote down the tides, the things that needed mending, and whatever I was afraid I might forget."
},
{
"startMs": 9868,
"endMs": 17783,
"text": "You will find a little of all three in here. Take your time. There is no right way to turn these pages.\n\nWith all my love,\nGran"
}
]
},
"cottage.window": {
"pageId": "cottage.window",
"resource": "narration_cottage_window",
"text": "The wind has finally gone quiet. I have put the blue cup by the window, where you always liked to sit.\n\nThe latch still sticks. Lift it a little before you turn it. Some things on this island need a gentle hand, not a stronger one.\n\nIf you arrive after dark, there is something in the little drawer beside the hearth.",
"file": "narration_cottage_window.flac",
"sampleRate": 24000,
"channels": 1,
"frames": 499104,
"durationMs": 20796,
"textSha256": "10b04750290618c667a1ab3e92247d59ea6796ac33c910906b292b6735da204c",
"flacSha256": "01864da94337c06445b60694faf2484c4a59f5f11fabc0f8d8b87a620ee09193",
"cues": [
{
"startMs": 180,
"endMs": 6473,
"text": "The wind has finally gone quiet. I have put the blue cup by the window, where you always liked to sit."
},
{
"startMs": 7073,
"endMs": 15009,
"text": "The latch still sticks. Lift it a little before you turn it. Some things on this island need a gentle hand, not a stronger one."
},
{
"startMs": 15609,
"endMs": 20196,
"text": "If you arrive after dark, there is something in the little drawer beside the hearth."
}
]
},
"cottage.match.memory": {
"pageId": "cottage.match.memory",
"resource": "narration_cottage_match_memory",
"text": "You used to insist on lighting the evening lantern yourself. I held the matchbox, and you held your breath.\n\nOnce, you asked how such a little flame could help anyone out at sea.\n\nIt cannot, I told you. But it can help us find the next light.\n\nI kept one dry match in a tin after that. Just in case.",
"file": "narration_cottage_match_memory.flac",
"sampleRate": 24000,
"channels": 1,
"frames": 506848,
"durationMs": 21119,
"textSha256": "b047af77227d4084883babe2d7bec9cbebf8a3d807cf8d45b72e76f72db9eac5",
"flacSha256": "6cd5fadf22ce6f8ebc6a9c8968e87fb1b31a0f1e52693c7e942d8498691a533c",
"cues": [
{
"startMs": 180,
"endMs": 6644,
"text": "You used to insist on lighting the evening lantern yourself. I held the matchbox, and you held your breath."
},
{
"startMs": 7244,
"endMs": 11212,
"text": "Once, you asked how such a little flame could help anyone out at sea."
},
{
"startMs": 11812,
"endMs": 15801,
"text": "It cannot, I told you. But it can help us find the next light."
},
{
"startMs": 16401,
"endMs": 20519,
"text": "I kept one dry match in a tin after that. Just in case."
}
]
},
"cottage.folded.note": {
"pageId": "cottage.folded.note",
"resource": "narration_cottage_folded_note",
"text": "If the tide has covered the causeway, use the little boat by the harbour steps. The knot looks worse than it is.\n\nTake the lantern. When you reach the bell, ring twice. I will know it is you.\n\nAnd do not let the tea go cold while you are deciding.\n\nLove, Gran",
"file": "narration_cottage_folded_note.flac",
"sampleRate": 24000,
"channels": 1,
"frames": 425888,
"durationMs": 17745,
"textSha256": "2101efa580ab39cff6956a3e0011d5399e820aca79f9f60a25848487c6bcb9ad",
"flacSha256": "3675b260102c1b157e8741ff6ed9d062735860d33a15d1bbe397d997e91a2403",
"cues": [
{
"startMs": 180,
"endMs": 6964,
"text": "If the tide has covered the causeway, use the little boat by the harbour steps. The knot looks worse than it is."
},
{
"startMs": 7564,
"endMs": 12108,
"text": "Take the lantern. When you reach the bell, ring twice. I will know it is you."
},
{
"startMs": 12708,
"endMs": 17145,
"text": "And do not let the tea go cold while you are deciding.\n\nLove, Gran"
}
]
},
"cottage.lantern.sketch": {
"pageId": "cottage.lantern.sketch",
"resource": "narration_cottage_lantern_sketch",
"text": "Your grandfather repaired this handle with a piece of wire and far too much confidence. I wrapped the join so it would not catch your fingers.\n\nPeople notice the flame first. I tend to notice the things that let us carry it.",
"file": "narration_cottage_lantern_sketch.flac",
"sampleRate": 24000,
"channels": 1,
"frames": 366944,
"durationMs": 15289,
"textSha256": "fbfc663172995a1beb20b48e65b8f469b44b7bf26609721fe34b158ecc9bdf97",
"flacSha256": "60a823473a66b1ea4c5156889f66fe276bc103db475a3e6c831cd41649d7cbd3",
"cues": [
{
"startMs": 180,
"endMs": 8735,
"text": "Your grandfather repaired this handle with a piece of wire and far too much confidence. I wrapped the join so it would not catch your fingers."
},
{
"startMs": 9335,
"endMs": 14689,
"text": "People notice the flame first. I tend to notice the things that let us carry it."
}
]
}
}
}
+125
View File
@@ -0,0 +1,125 @@
{
"premise": "The storm has passed, but the island is still dark. In your grandmother Mara’s notebook, you find a promise: no one comes home to an unlit shore. Recover what the storm scattered. Bring the lighthouse back to life.",
"levels": [
{
"chapter": "I · The keeper’s cottage",
"title": "A spark in the drawer",
"object": "A match",
"before": "You find Mara’s cottage with its windows shuttered. On the table is her notebook: ‘Start with one small light.’ The first page is water-stained. Restore its pattern.",
"after": "A dry match, hidden in a tin. You strike it against the hearth. For a moment, the cottage feels like it remembers you.",
"picture": "0011000011110000110000001000000100000010000001000",
"clues": "",
"areas": ""
},
{
"chapter": "I · The keeper’s cottage",
"title": "Something to carry the flame",
"object": "The lantern",
"before": "A small flame will not survive the wind. Mara’s next page shows what she carried on her evening rounds.",
"after": "The lantern is soot-black but sound. Its warm circle of light reaches the cottage door. Beneath the handle, Mara has scratched your initials.",
"picture": "0011100001010001111100100010010101001000100111110",
"clues": "1,5,9,11",
"areas": ""
},
{
"chapter": "I · The keeper’s cottage",
"title": "Under the loose floorboard",
"object": "The brass key",
"before": "‘Some clues belong to more than one place,’ Mara wrote. Compare the overlapping areas on this page; a shared cell counts in both. A loose floorboard waits by the door.",
"after": "A brass key turns up beneath the board. The tag reads ‘harbour store’. Someone prepared for a journey and never quite made it out of the cottage.",
"picture": "0011100010001001000100011100000100000011000001000",
"clues": "",
"areas": "1,2,4,3;3,2,2,4;3,2,2,3"
},
{
"chapter": "I · The keeper’s cottage",
"title": "A direction in the dark",
"object": "Mara’s compass",
"before": "The lane has vanished beneath fallen branches. One last page in the cottage points you towards the harbour. Use what the areas share to work out what lies outside them.",
"after": "The compass needle settles towards the sea. Tucked inside its lid is a note: ‘When the path disappears, keep your bearings.’ You step into the rain.",
"picture": "0001000001110001010101111111010101000111000001000",
"clues": "15,36",
"areas": "1,3,2,2;3,2,3,3;2,0,3,5"
},
{
"chapter": "II · Across the tide",
"title": "At the water’s edge",
"object": "The little boat",
"before": "The tide has covered the causeway. A shape knocks gently against the harbour steps. Mara’s notebook has a page for this crossing too.",
"after": "The little boat is still tied fast. You bail out the rainwater, set the lantern in the bow, and push away from the steps.",
"picture": "0001000000110000011100001000111111101111101000001",
"clues": "",
"areas": "0,3,5,2;3,1,3,3;2,2,4,4"
},
{
"chapter": "II · Across the tide",
"title": "What holds us steady",
"object": "The anchor",
"before": "The current tugs you towards the outer rocks. Something heavy is tangled beneath the seat. The pattern tells you what to reach for.",
"after": "The anchor catches. The boat swings into calmer water. In the pause, you hear a bell somewhere beyond the fog.",
"picture": "0011100001010000111000001000100100101010100011100",
"clues": "11,36,40",
"areas": "2,3,3,3;2,1,4,2;1,1,3,4"
},
{
"chapter": "II · Across the tide",
"title": "The old crossing",
"object": "The stone bridge",
"before": "You land beneath the lighthouse hill. The old crossing is hidden by reeds. Mara marked its outline long before the storm.",
"after": "The bridge is intact. You cross with the lantern held high. On the far bank, a fresh bootprint tells you someone else has passed this way.",
"picture": "0000000011111011000111000001100000111111110000000",
"clues": "",
"areas": "2,1,3,5;0,2,5,3;2,3,2,2"
},
{
"chapter": "II · Across the tide",
"title": "An answer through the fog",
"object": "The harbour bell",
"before": "A rope hangs from a timber frame. The bell above it has fallen silent. Restore the pattern before you call out across the water.",
"after": "One clear note travels into the fog. Two notes answer from the hill. Someone is waiting at the lighthouse.",
"picture": "0001000001110000101000100010010001011111110001000",
"clues": "2",
"areas": "3,2,3,3;2,0,4,4;0,3,5,2"
},
{
"chapter": "III · The last light",
"title": "Inside the turning room",
"object": "The missing gear",
"before": "Mara opens the lighthouse door. ‘I knew you’d find the notebook,’ she says. The storm stopped the turning mechanism. Together, you lay out its scattered parts.",
"after": "The missing gear slips into place. You turn the handle; the mechanism answers with a familiar, steady ticking. Mara smiles without looking up.",
"picture": "0010100011111011000110101010110001101111100010100",
"clues": "9,24",
"areas": "2,3,3,3;1,3,5,3;1,2,4,3"
},
{
"chapter": "III · The last light",
"title": "A circle of glass",
"object": "The beacon lens",
"before": "The great lens is clouded with salt. Mara holds the lantern while you work. The areas overlap like the rings in the glass; compare them carefully.",
"after": "You wipe the last salt from the lens. The lantern’s tiny flame stretches into a bright arc across the walls. Everything is ready.",
"picture": "0011100010001010010011001101100100101000100011100",
"clues": "7,13,36,40",
"areas": "1,2,5,3;2,3,3,2;2,2,3,2"
},
{
"chapter": "III · The last light",
"title": "No unlit shore",
"object": "The lighthouse",
"before": "Mara gives you the handle. Below the windows, the island lies dark. This is the pattern all the other pages were leading towards.",
"after": "The beacon turns. Its light sweeps the harbour, the bridge, the little boat. Far offshore, a ship sounds its horn. The island has its light again.",
"picture": "0001000001110011111110011100001010001101101111111",
"clues": "",
"areas": "1,3,4,2;0,3,2,2;2,2,4,2"
},
{
"chapter": "III · The last light",
"title": "A light in the window",
"object": "Home",
"before": "Dawn finds you walking back with Mara. There is one blank page at the end of the notebook. ‘That one is yours,’ she says.",
"after": "You light the cottage window. Mara puts the kettle on. Beneath your new drawing, you write: ‘No one comes home to an unlit shore.’ The notebook closes. Your watch has begun.",
"picture": "0001000001110001111101111111010001001010100111110",
"clues": "",
"areas": "0,1,6,2;2,3,4,3;0,2,4,3"
}
]
}
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
Copyright 2016 The Dancing Script Project Authors (https://github.com/googlefonts/DancingScript), with Reserved Font Name 'Dancing Script'.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+5 -8
View File
@@ -1,11 +1,11 @@
# Bundled diary readings
Five fixed readings accompany the opening notebook leaves. They are **synthetic narration rendered during development**, using Kokoro v1.0 / `bf_emma` (British female), not human voice-actor recordings. The app only plays files using Android MediaPlayer. It contains no speech model, Android reader integration, runtime synthesis, or audio download.
Five fixed readings accompany the opening notebook leaves. They are **synthetic narration rendered during development**, using Kokoro v1.0 / `bf_emma` (British female), not human voice-actor recordings. The app only plays files using just_audio’s platform decoder. It contains no speech model, Android reader integration, runtime synthesis, or audio download.
- `scripts.json`: exact current non-puzzle text exported from `StoryBook.java`.
- `scripts.json`: canonical non-puzzle text loaded directly by the Flutter story pages.
- `wav/`: reviewable 24 kHz mono PCM16 WAV masters.
- `manifest.json`: model/voice checksums, generator versions, exact scripts, passage timings and FLAC checksums.
- `app/src/main/res/raw/narration_*.flac`: lossless bundled copies. FLAC compression is disabled in APK packaging so MediaPlayer can open resource file descriptors.
- `assets/audio/narration_*.flac`: lossless bundled copies.
- `licenses/`: Kokoro ONNX wrapper MIT and model Apache 2.0 licenses.
The voice uses generation speed 0.82, 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 never autoplay on entry.
@@ -14,16 +14,13 @@ The voice uses generation speed 0.82, short fades, paragraph pauses and peak nor
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).
Use Python 3.12, dependencies pinned in `requirements.txt`, ffmpeg and a JDK. Keep model data outside the Android project. Export updated scripts before regenerating:
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:
```sh
mkdir -p /tmp/lumen-narration-export
javac -d /tmp/lumen-narration-export app/src/main/java/com/lumen/daily/StoryBook.java scripts/ExportNarration.java
java -cp /tmp/lumen-narration-export com.lumen.daily.ExportNarration > assets/narration/scripts.json
python scripts/render_narration.py --model /path/to/kokoro-v1.0.onnx --voices /path/to/voices-v1.0.bin
python3 scripts/check_narration_assets.py
```
The check requires only Python’s standard library, a JDK and ffmpeg. It verifies script freshness, cue coverage, master format, checksums and bit-identical WAV/FLAC decoding. It also rejects Android reader imports in app code. Listen to new takes before accepting them; automated checks cannot judge performance or pronunciation.
The check requires only Python’s standard library and ffmpeg. It verifies script freshness, cue coverage, master format, checksums 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.
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.