Jarvis / scripts /make_samples.py
broduer's picture
Ship Jarvis LVM v1.1: jarvis-prime preset, JARVIS delivery planner, reproducible samples
50962bd verified
Raw History Blame Contribute Delete
1.85 kB
#!/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()