| """Render all hand-authored showcase reruns.""" |
|
|
| from __future__ import annotations |
|
|
| import json |
| from dataclasses import asdict |
| from pathlib import Path |
|
|
| from midnight_static.mixer import mix_crude_broadcast |
| from midnight_static.showcase_scripts import SHOWCASE_SCRIPT_FACTORIES |
| from midnight_static.tts import render_script_wav |
|
|
| SHOWCASE_OUTPUTS = { |
| "phone_booth": "the-case-of-a-phone-booth-that-rings-under", |
| "lighthouse": "the-case-of-two-rival-lighthouse-keepers-one-light", |
| "wrong_bride": "the-case-of-a-wedding-where-every-guest-recognizes", |
| } |
|
|
|
|
| def main() -> None: |
| output_dir = Path("assets/showcases") |
| output_dir.mkdir(parents=True, exist_ok=True) |
| for showcase_id, factory in SHOWCASE_SCRIPT_FACTORIES.items(): |
| stem = SHOWCASE_OUTPUTS[showcase_id] |
| script = factory() |
| script_path = output_dir / f"{stem}.json" |
| dialogue_path = output_dir / f"{stem}.dialogue.wav" |
| audio_path = output_dir / f"{stem}.crude.wav" |
| script_path.write_text(json.dumps(asdict(script), indent=2), encoding="utf-8") |
| render_script_wav(script, dialogue_path) |
| mix_crude_broadcast(dialogue_path, audio_path) |
| dialogue_path.unlink(missing_ok=True) |
| print(audio_path) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|