#!/bin/sh # speak.sh VOICE: text on stdin, piper's WAV of it on stdout. VOICE is an .onnx with its .onnx.json beside it. # The Nix build fills in @piper@ (server.nix). set -eu voice=$1 tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT @piper@/bin/piper -m "$voice" -f "$tmp/out.wav" 2>"$tmp/err" || { cat "$tmp/err" >&2; exit 1; } cat "$tmp/out.wav"