Sound library: per-channel SoundCraft sources, exports and variant slots; Tots sample; ident fallback

Ported the ident fallback from release-0.108 (0.108.100).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 22:14:54 +00:00
co-authored by Claude Opus 5.5
parent 5cddcce09c
commit f4ae227eba
232 changed files with 984 additions and 32550 deletions
@@ -121,7 +121,10 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
Box(Modifier.fillMaxSize().graphicsLayer { alpha = fade.value }.background(NightNavy)) {
// Reduce motion: the still card (the logo over the next show's picture) instead of a moving ident, so no sting either
// (Paul, 7 November 2026: sensory settings shape the ident, sound included). Tots keeps its still goodbye.
val video = if (cameo != null || (settings.reduceMotion && mood == null)) null else block?.video ?: identVideo(channel.number, next.startMs)
// An ident that fails to play (a damaged file, a decoder it can't get) falls back to the silent still card. The ident
// only covers a show's last seconds on the schedule's clock, so it never holds up the next programme either way.
var failed by remember { mutableStateOf(false) }
val video = if (failed || cameo != null || (settings.reduceMotion && mood == null)) null else block?.video ?: identVideo(channel.number, next.startMs)
// With idents off, Tots still says goodbye with a picture that doesn't move.
if (mood != null && (!settings.idents || settings.reduceMotion)) Image(cachedPainter(mood.still), null, Modifier.fillMaxSize())
// Every third Tots changeover, a drawn bumper with the cast instead of the filmed ident.
@@ -141,6 +144,11 @@ internal fun IdentOverlay(session: EmbySampleSession, channel: SampleChannel, ne
volume = if (block != null) (if (settings.blockIdentSound) 1f else 0f)
else if (mood != null && settings.identSound && !settings.reduceMotion && TotsJingle.take(mood, System.currentTimeMillis())) identVolume(settings.identSoundQuiet)
else if (mood == null && settings.identSound && IdentStings.take(channel.number, System.currentTimeMillis())) identVolume(settings.identSoundQuiet) else 0f
addListener(object : androidx.media3.common.Player.Listener {
override fun onPlayerError(error: androidx.media3.common.PlaybackException) {
android.util.Log.w("OrbitSchedule", "ident channel=${channel.number} failed=${error.errorCodeName}"); failed = true
}
})
prepare(); playWhenReady = true
}
}
+23 -6
View File
@@ -11,8 +11,9 @@ from pathlib import Path
HERE = Path(__file__).parent
STEMS = HERE / "out"
SESSIONS = HERE / "sessions"; SESSIONS.mkdir(exist_ok=True)
MIX = HERE / "mix"; MIX.mkdir(exist_ok=True)
# The sound library (Paul, 7 November 2026): each channel's SoundCraft session is its editable source, in library/<key>/, with
# its exports beside it (export/<variant>.wav). Orbit's delivered asset is made from an export by deliver.py, never by hand.
LIBRARY = HERE / "library"; LIBRARY.mkdir(exist_ok=True)
END = 308700 # 7 s at 44.1 kHz
B = 960 # ticks a beat (SoundCraft counts 960 to the quarter note)
@@ -215,6 +216,17 @@ def brief_v2(number):
}.get(number)
def tots():
"""Tots, sensory-conscious (Paul, 7 November 2026): a gentle, playful xylophone and a warm, reassuring melody. No drums, soft
mallets with no sharp attack, nothing piercing up top, and the whole sting kept within a narrow, calm range."""
MALLET = dict(osc1_wave=2, osc2_wave=3, osc2_semitones=12, osc_mix=22, cutoff=2600, resonance=0, amp_attack=12, amp_decay=650, amp_sustain=0, amp_release=500, level=-8)
C = 60
tune = [(4, 1), (7, 1.5), (9, 2), (7, 2.5), (4, 3), (2, 3.5), (0, 4.5)]
return [synth("Xylophone", MALLET, [n(C + p, b, .45, 64) for p, b in tune] + [n(C + 12, 6, 1.5, 58)], [ROOM, ("eq_7band", dict(high_shelf_gain=-4, high_shelf_freq=5000))], -2),
synth("Warmth", PAD | dict(osc1_wave=2, osc2_wave=3, osc2_detune=6, cutoff=1300, amp_attack=1400, amp_release=2200), chord(C - 12, (0, 4, 7, 12), 0, 11, 55), [ROOM], -10),
synth("Bass", BASS | dict(osc1_wave=2, osc2_wave=2, cutoff=400, amp_attack=60), [n(C - 24, 1, 3, 55), n(C - 29, 4.5, 2, 55), n(C - 24, 6, 4, 55)], [], -12)]
SPECIAL = {"mistletoe": [stem("mistletoe.wav", -2), synth("Pad", PAD | dict(cutoff=1200), chord(36, (0, 7, 16, 19, 26), 1, 9, 70), [HALL], -9)],
"sakura": [stem("sakura.wav", -2), synth("Pad", PAD | dict(osc1_wave=3, osc2_wave=2, cutoff=1500), chord(45, (0, 7, 14, 15), 2, 9, 60), [HALL, CHORUS], -10)]}
@@ -253,17 +265,22 @@ def script(layers):
return "\n".join(lines) + "\n"
def build(key, layers):
sc = MIX / f"{key}.txt"; sc.write_text(script(layers))
r = subprocess.run(["soundcraft-cli", "script", str(sc), "--bounce", str(MIX / f"{key}.wav"), "--save", str(SESSIONS / f"{key}.scraft")],
def build(key, layers, variant="sting"):
home = LIBRARY / key; (home / "export").mkdir(parents=True, exist_ok=True)
name = key if variant == "sting" else f"{key}-{variant}"
sc = home / f"{name}.commands.txt"; sc.write_text(script(layers))
r = subprocess.run(["soundcraft-cli", "script", str(sc), "--bounce", str(home / "export" / f"{variant}.wav"), "--save", str(home / f"{name}.scraft")],
capture_output=True, text=True)
ok = r.returncode == 0
print(key, "ok" if ok else "FAILED", (r.stdout.strip().splitlines() or [""])[-2][:160] if ok else (r.stderr or r.stdout)[-400:])
print(key, variant, "ok" if ok else "FAILED", (r.stdout.strip().splitlines() or [""])[-2][:160] if ok else (r.stderr or r.stdout)[-400:])
return ok
if __name__ == "__main__":
only = set(sys.argv[1:])
# Tots, as a sample to hear first: built into the library, not delivered until Paul approves it.
if "tots" in only: build("tots", tots()); only.discard("tots")
if not only and len(sys.argv) > 1: sys.exit(0)
for key, layers in list(SPECIAL.items()) + [(f"ch{n}", brief_v2(n) or brief(n)) for n in (101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206,
301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 401, 601, 602, 603, 604, 605, 611, 612, 613)]:
if only and key not in only: continue
+4 -2
View File
@@ -53,8 +53,10 @@ def deliver(raw: Path, ident: str, audio: Path, tmp: Path, aim=None):
if __name__ == "__main__":
raw = Path(sys.argv[1])
mixes = HERE / "mix"
jobs = [(f"ident_{k.removeprefix('ch')}" if k.startswith("ch") else f"ident_{k}", mixes / f"{k}.wav") for k in sorted(p.stem for p in mixes.glob("*.wav"))]
# Each channel's sting export from the library; Tots' new SoundCraft version waits there until it's approved.
library = HERE / "library"
jobs = [(f"ident_{k.removeprefix('ch')}" if k.startswith("ch") else f"ident_{k}", library / k / "export" / "sting.wav")
for k in sorted(p.name for p in library.iterdir() if (p / "export" / "sting.wav").exists() and p.name != "tots")]
with tempfile.TemporaryDirectory() as t:
tmp = Path(t)
# Tots keeps its own jingles, levelled to the same standard from the audio already in its idents.
+13
View File
@@ -0,0 +1,13 @@
# Orbit sound library
Each channel's sound lives here: `<key>/<key>.scraft` is the editable SoundCraft session (its source), and `<key>/export/` holds what
it renders. Orbit's delivered ident (`res/raw/ident_*.mp4`) is always made from an export by `../deliver.py`, never edited by hand.
- Build or rebuild a channel: `python3 design/channels/sound/build-soundcraft.py ch601` (several keys at once, or none for all).
`tots` builds the Tots sample.
- Deliver to Orbit: `python3 design/channels/sound/deliver.py <android>/app/src/main/res/raw`. This applies the standard: -23 LUFS,
-2 dBTP, and the loudest moment no more than 6 LU above the average. Tots' Wind Down is 2 LU gentler.
- Variants: `library.json` keeps a slot for each one, all empty for now: a short transition, a longer channel opening, a
seasonal arrangement and a calmer version. `build(key, layers, variant="calm")` renders one to `export/calm.wav` beside the
sting, from its own session `<key>-calm.scraft`, so the main sting is never touched.
- Hear before rebuilding everything: render two or three representative channels first, listen, then do the rest.

Some files were not shown because too many files have changed in this diff Show More