#!/usr/bin/env bash set -euo pipefail SRC="${1:-}" VOL="${2:-0.9}" SNAP_IP="127.0.0.1" SNAP_PORT="4953" if [[ -z "$SRC" ]]; then echo "Usage: $0 [vol]" exit 1 fi if [[ "$SRC" =~ ^https?:// ]]; then curl -sL "$SRC" | \ sox -t wav - \ -t raw -r 48000 -c 2 -b 16 -e signed-integer - \ vol "$VOL" | \ nc -q 1 "$SNAP_IP" "$SNAP_PORT" else sox "$SRC" \ -t raw -r 48000 -c 2 -b 16 -e signed-integer - \ vol "$VOL" | \ nc -q 1 "$SNAP_IP" "$SNAP_PORT" fi