20 lines
486 B
Bash
Executable File
20 lines
486 B
Bash
Executable File
#!/bin/bash
|
|
# Piper TTS wrapper for OpenClaw
|
|
# Usage: piper-tts.sh "text to speak" [output_file]
|
|
|
|
TEXT="${1:-Hello}"
|
|
OUTPUT="${2:-/tmp/piper_output.wav}"
|
|
MODEL="${PIPER_MODEL:-$HOME/.config/piper/voices/en_US-ryan-medium.onnx}"
|
|
|
|
# Generate speech
|
|
echo "$TEXT" | $HOME/.local/bin/piper --model "$MODEL" --output_file "$OUTPUT" 2>/dev/null
|
|
|
|
# Check if file was created
|
|
if [ -f "$OUTPUT" ]; then
|
|
echo "$OUTPUT"
|
|
exit 0
|
|
else
|
|
echo "Error: TTS generation failed" >&2
|
|
exit 1
|
|
fi
|