#!/bin/bash # Script to install Piper TTS echo "Installing Piper TTS..." # Detect OS OS="$(uname -s)" ARCH="$(uname -m)" case "${OS}" in Linux*) if [ "${ARCH}" = "x86_64" ]; then PIPER_URL="https://github.com/rhasspy/piper/releases/download/v1.2.0/piper_amd64.tar.gz" elif [ "${ARCH}" = "aarch64" ]; then PIPER_URL="https://github.com/rhasspy/piper/releases/download/v1.2.0/piper_arm64.tar.gz" else echo "Unsupported architecture: ${ARCH}" exit 1 fi ;; Darwin*) if [ "${ARCH}" = "x86_64" ] || [ "${ARCH}" = "arm64" ]; then PIPER_URL="https://github.com/rhasspy/piper/releases/download/v1.2.0/piper_macos_x64.tar.gz" else echo "Unsupported architecture: ${ARCH}" exit 1 fi ;; *) echo "Unsupported OS: ${OS}" exit 1 ;; esac # Create temp directory TEMP_DIR=$(mktemp -d) cd "${TEMP_DIR}" # Download Piper echo "Downloading Piper from ${PIPER_URL}..." curl -L -o piper.tar.gz "${PIPER_URL}" # Extract echo "Extracting..." tar -xzf piper.tar.gz # Install to /usr/local/bin (requires sudo) echo "Installing to /usr/local/bin (may require password)..." sudo cp piper/piper /usr/local/bin/ sudo chmod +x /usr/local/bin/piper # Cleanup cd - rm -rf "${TEMP_DIR}" # Verify installation if command -v piper &> /dev/null; then echo "✓ Piper TTS installed successfully!" piper --version else echo "✗ Installation failed" exit 1 fi echo "" echo "To download voice models, they will be automatically downloaded on first use." echo "Or you can manually download from: https://github.com/rhasspy/piper/releases/tag/v1.2.0"