File size: 1,850 Bytes
50962bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
"""Render the demo WAVs shipped in ``samples/``.

    python scripts/make_samples.py

Every file is produced by the engine in this package with the packaged style
vectors, at the packaged default speed, using the JARVIS delivery plan. Rerun it
after changing a preset or the delivery pacing so the demos stay honest.
"""

from __future__ import annotations

import argparse
from pathlib import Path

from jarvis_lvm.engine import DEFAULT_SPEED, JarvisLVM

LINES = {
    "greeting": "Good evening, sir. All systems are functioning within normal parameters.",
    "briefing": (
        "I have reviewed the overnight telemetry, and the results are "
        "encouraging. Your calendar is clear for the next two hours."
    ),
    "status": (
        "Reactor output is steady at ninety-four percent. Cooling is nominal, "
        "and no faults were logged since your last check."
    ),
}

PRESETS = ("jarvis-prime", "jarvis-classic", "jarvis-deep")


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--out", type=Path, default=Path("samples"))
    parser.add_argument("--speed", type=float, default=DEFAULT_SPEED)
    parser.add_argument("--style", default="jarvis", choices=("jarvis", "off"))
    args = parser.parse_args()

    model = JarvisLVM()
    args.out.mkdir(parents=True, exist_ok=True)
    for preset in PRESETS:
        for name, text in LINES.items():
            result = model.synthesize(
                text, voice=preset, speed=args.speed, style=args.style
            )
            path = args.out / f"{preset}-{name}.wav"
            path.write_bytes(result.wav)
            print(
                f"{path}  {result.seconds}s  segments={result.segments}  "
                f"style={result.style}"
            )


if __name__ == "__main__":
    main()