Open Lumen on a responsive bookshelf and land pending story work

- Start the app on a shelf of every installed book instead of the last
  book's home. Cards show the cover, translated metadata, available
  languages, restored patterns and either "Continue reading" or a way in.
- Keep each book's saved route: the shelf is never written to
  flutter_screen, so choosing a book resumes its own leaf.
- Lay the shelf out responsively: dense single-column cards on phones,
  a two-column grid from 720 logical pixels, a centred 860 px column on
  tablets and a chevron that exists in the bundled handwriting font.
- Keep Settings reachable from the shelf and let the home page's story
  library button open the shelf instead of a dialog.
- Add tool/shelf_screenshots_test.dart, which renders the shelf at phone
  and tablet metrics, checks that every card and Settings stay reachable
  without overflow, and writes artifacts/library/shelf-*.png.
- Commit the pending Midnight Invitation package (campaign, notebook,
  narration and artwork), cast drama and ambience tooling, region
  selection, phone/tablet integration coverage and related docs.

flutter analyze is clean and all 74 widget/domain tests pass.
This commit is contained in:
Hadrian Burkhardt
2026-11-05 14:29:50 +01:00
parent d45cd0698a
commit 0718e3f252
149 changed files with 16875 additions and 393 deletions
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env python3
"""Original wind, kitchen and haunted-house textures for The Midnight Invitation."""
import hashlib
import json
from pathlib import Path
import numpy as np
import soundfile as sf
ROOT = Path(__file__).resolve().parents[1]
OUT = ROOT / 'assets/stories/midnight-invitation/audio'
RATE, SECONDS = 24000, 36
N = RATE * SECONDS
T = np.arange(N) / RATE
F = np.fft.rfftfreq(N, 1 / RATE)
tracks = {}
for name, seed in [('threshold', 103101), ('kitchen', 103102), ('hall', 103103)]:
rng = np.random.default_rng(seed)
def noise(low, high):
spectrum = np.fft.rfft(rng.normal(size=N))
spectrum *= (1 - np.exp(-(F / low) ** 4)) * np.exp(-(F / high) ** 2)
signal = np.fft.irfft(spectrum, n=N)
return signal / np.sqrt(np.mean(signal ** 2))
def swell(cycles, phase=0):
return .65 + .35 * np.sin(2 * np.pi * cycles * T / SECONDS + phase)
if name == 'threshold':
# Gentle air around a sheltered porch; leaves move in longer gusts.
sound = .75 * noise(75, 950) * swell(2, .3)
sound += .20 * noise(800, 3300) * swell(5, 1.2) ** 3
elif name == 'hall':
# Sheltered air and distant timber strain, with no voices or clock ticks.
sound = .50 * noise(45, 420) * swell(2, .7)
sound += .09 * noise(300, 1600) * swell(5, 1.4) ** 3
for onset in [6.2, 18.7, 29.1]:
distance = (T - onset + SECONDS / 2) % SECONDS - SECONDS / 2
envelope = np.exp(-(distance / .55) ** 2)
sound += .035 * np.sin(2 * np.pi * (190 * T + .12 * np.sin(2 * np.pi * T))) * envelope
else:
# Low stove draft and irregular, small embers, without a musical bed.
sound = .22 * noise(65, 650) * swell(2, 1.1)
sound += .07 * noise(500, 2200)
embers = noise(800, 4200)
for onset in rng.uniform(1, SECONDS - 1, 48):
dt = T - onset
envelope = np.where(dt >= 0, np.exp(-np.maximum(dt, 0) * 35), 0)
sound += rng.uniform(.13, .42) * embers * envelope
sound -= np.mean(sound)
ramp = np.linspace(0, 1, RATE // 20)
sound[-len(ramp):] -= (sound[-1] - sound[0]) * ramp * ramp * (3 - 2 * ramp)
sound *= .10 / np.sqrt(np.mean(sound ** 2))
sound *= min(1, .65 / np.max(np.abs(sound)))
path = OUT / f'ambience_{name}.wav'
sf.write(path, sound, RATE, subtype='PCM_16')
pcm, rate = sf.read(path)
assert abs(pcm[-1] - pcm[0]) <= 1 / 32768
tracks[name] = {'asset':path.relative_to(ROOT).as_posix(), 'sampleRate':RATE,
'channels':1, 'durationMs':SECONDS*1000, 'seed':seed,
'wavSha256':hashlib.sha256(path.read_bytes()).hexdigest(),
'peak':float(np.max(np.abs(pcm))), 'rms':float(np.sqrt(np.mean(pcm**2)))}
print(f'{name}: {SECONDS}s, peak {tracks[name]["peak"]:.3f}, seamless PCM loop')
(OUT/'atmosphere_provenance.json').write_text(json.dumps({
'method':'Original procedural textures, rendered offline; no third-party recordings or runtime synthesis.',
'generator':'scripts/render_drama_atmosphere.py', 'tracks':tracks,
},indent=2)+'\n')