Improve phone ambience and dialogue flow; keep stairwell intact

This commit is contained in:
Codex
2026-10-30 01:03:42 +02:00
parent eaefde2e07
commit 6549ba9308
53 changed files with 1868 additions and 295 deletions
@@ -0,0 +1,43 @@
"""Install the eight short prologue replies; preserve all existing voice takes."""
from pathlib import Path
import hashlib
import json
import runpy
import shutil
ROOT = Path(__file__).resolve().parents[1]
WORK = ROOT / "builds/soundscape"
GAME = ROOT / "do-otboy"
def read(path): return json.loads(path.read_text(encoding="utf-8"))
def write(path, value): path.write_text(json.dumps(value, ensure_ascii=False, indent=2)+"\n", encoding="utf-8")
assembly = read(WORK / "fill_assembly.json")
metadata = read(GAME / "data/voice_manifest.json")
alignment = read(ROOT / "voiceover/alignment.json")
for key, source in assembly.items():
lines = {e["id"]: e for e in read(WORK / ("fill_" + key + "_lines.json"))}
segments = read(WORK / ("fill_" + key + "_split/alignment.json"))
assert len(segments) == 4
alignment["fill_" + key] = segments
for segment in segments:
ident = segment["id"]
assert segment["matched_words"] == segment["reference_words"]
path = WORK / ("fill_" + key + "_split") / (ident + ".wav")
shutil.copyfile(path, GAME / "assets/voice" / path.name)
metadata[ident] = dict(**lines[ident], **source, provider="ElevenLabs",
voice=source["voice_name"], file="assets/voice/" + path.name,
source_start=segment["start"], source_end=segment["end"],
wav_duration=segment["duration"], sha256=hashlib.sha256(path.read_bytes()).hexdigest())
runpy.run_path(str(ROOT / "tools/write_phone_story.py"))
runpy.run_path(str(ROOT / "tools/write_voice_direction.py"))
score = {e["id"]: e for e in read(ROOT / "voiceover/performance.json")["lines"]}
assert set(metadata) == set(score)
for key, entry in metadata.items():
if key.startswith("intro_") and key in score:
for field in ["direction", "pronunciation", "tts_text"]: entry[field] = score[key][field]
write(GAME / "data/voice_manifest.json", metadata)
write(ROOT / "voiceover/alignment.json", alignment)
for character, speaker in [("carol", "Мама"), ("jessica", "Катя")]:
entries = [dict(e, file="../../do-otboy/"+e["file"]) for e in metadata.values() if e["speaker"] == speaker]
write(ROOT / "voiceover" / character / "manifest.json", dict(status="complete", version="0.2.3", voice_id=entries[0]["voice_id"], voice_name=entries[0]["voice_name"], ready=entries, pending=[]))
write(ROOT / "voiceover" / character / "alignment.json", [e for batch in alignment.values() for e in batch if metadata[e["id"]]["speaker"] == speaker])
print("Conversation updated: 52 Jessica and 58 Carol lines; all previous takes preserved")