NoteStack-Test / renderer /scripts /make_demo_vo.py
Arslan1997's picture
LETS GOOOOOOOOOOOOOOOOOOOOOOOOO
d326c2d
Raw History Blame
2.19 kB
"""Narration for the landing page demo (Nora Vale, Mission Control). Writes public/demo-vo/*.mp3 + durations.json.
The screens show the product; the voice never explains it, it only says how it feels: exploring,
excited, mesmerized. Also writes src/compositions/demoVo.ts; scenes stretch to fit their lines.
make_demo_music.py writes a 47.5 s score; raise its TOTAL and rerun it if the demo grows past that.
cd backend && PYTHONPATH=. .venv/Scripts/python ../renderer/scripts/make_demo_vo.py
"""
import json
import uuid
from pathlib import Path
from app.services import tts
OUT = Path(__file__).resolve().parents[1] / "public" / "demo-vo"
OUT.mkdir(parents=True, exist_ok=True)
LINES = {
"warp": "Captain's log. Something wonderful is on the horizon.",
"paste": "Take a breath. That flutter of excitement? That's how every great expedition begins.",
"orbit": "And there it is. Everything you've made, shimmering... impossible to look away.",
"research": "A question sparks, and suddenly you're wide awake.",
"audio": "Lean back. Let it wash over you.",
"launchkit": "Your pulse quickens. You can't wait to share this.",
"launchpad": "Three, two, one... and you're flying.",
"outro": "Notestack. Clear skies ahead.",
}
voice_id = next(v["voice_id"] for v in tts.list_voices() if v["name"].startswith("Nora Vale"))
vs = tts.VoiceSettings(stability=0.55, similarity_boost=0.8, style=0.3, speed=0.93)
ws = uuid.UUID(int=0)
keys = list(LINES)
durations = {}
for i, key in enumerate(keys):
prev_text = LINES[keys[i - 1]] if i else None
next_text = LINES[keys[i + 1]] if i + 1 < len(keys) else None
clip = tts.synthesize(ws, LINES[key], voice_id, vs, prev_text, next_text)
(OUT / f"{key}.mp3").write_bytes(clip)
durations[key] = round(tts.mp3_seconds(clip), 2)
(OUT / "durations.json").write_text(json.dumps(durations, indent=2))
(Path(__file__).resolve().parents[1] / "src" / "compositions" / "demoVo.ts").write_text(
"// Generated by scripts/make_demo_vo.py: narration clip lengths in seconds. Do not edit by hand.\n"
f"export const DEMO_VO_SECONDS = {json.dumps(durations)} as const;\n"
)
print(json.dumps(durations))