Files
speech_piper/test_snapcast.sh
2026-01-09 10:33:49 +11:00

22 lines
656 B
Bash
Executable File

#!/bin/bash
SNAP_IP="127.0.0.1"
SNAP_PORT="4953"
echo "1. Testing connection to $SNAP_IP:$SNAP_PORT..."
# Check if port is open
if ! nc -z -v "$SNAP_IP" "$SNAP_PORT"; then
echo "ERROR: Port closed! Snapserver not listening on TCP."
exit 1
fi
echo " Port Open."
echo "2. Generating 3-second test tone (48k Stereo 16-bit)..."
# Generate pure sine wave, raw PCM, no headers
# -n = null input (synth)
# -t raw = raw output
# -r 48000 -c 2 -b 16 -e signed = match Snapserver config EXACTLY
sox -V3 -n -t raw -r 48000 -c 2 -b 16 -e signed-integer - synth 3 sine 440 vol 0.8 \
| nc -N "$SNAP_IP" "$SNAP_PORT"
echo "3. Sent. Did you hear a beep?"