File size: 1,424 Bytes
fc9b7e2
 
 
 
 
 
 
 
 
888ebed
fc9b7e2
 
 
 
 
 
 
 
 
 
 
 
 
888ebed
fc9b7e2
 
 
 
888ebed
 
 
 
 
fc9b7e2
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Render a Day 1 crude mix: Kokoro dialogue + hardcoded bed + SFX."""

from __future__ import annotations

import argparse
from pathlib import Path

from midnight_static.fixtures import fixture_script
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


def main() -> None:
    parser = argparse.ArgumentParser(description="Render a crude mixed broadcast.")
    parser.add_argument(
        "premise",
        nargs="?",
        default="a phone booth that rings under the sea",
        help="Premise to render with the fixture writer.",
    )
    parser.add_argument("--work-dir", default="outputs", help="Directory for intermediate WAVs.")
    parser.add_argument("--output", default="outputs/crude-broadcast.wav", help="Output WAV path.")
    parser.add_argument("--showcase", choices=sorted(SHOWCASE_SCRIPT_FACTORIES), help="Render a hand-authored showcase script.")
    args = parser.parse_args()

    work_dir = Path(args.work_dir)
    dialogue_path = work_dir / "crude-dialogue.wav"
    script = (
        SHOWCASE_SCRIPT_FACTORIES[args.showcase]()
        if args.showcase
        else fixture_script(args.premise)
    )
    render_script_wav(script, dialogue_path)
    output = mix_crude_broadcast(dialogue_path, Path(args.output))
    print(output)


if __name__ == "__main__":
    main()