Files
Veskslop-t/poc/scripts/audio-doctor.sh
T

84 lines
2.7 KiB
Bash

#!/usr/bin/env bash
# Veskslop audio doctor. Run it on the server while the bot sits in a call and
# people are talking. It shows where client audio goes and what the daemon sees.
set -uo pipefail
PORT="${WEBUI_PORT:-8789}"
section() { printf '\n== %s ==\n' "$1"; }
section "host addresses"
hostname -I 2>/dev/null || true
section "default sink"
pactl get-default-sink 2>&1 || true
section "sinks"
pactl list short sinks 2>&1 || true
section "sink inputs: who is playing, and into which sink"
if command -v pactl >/dev/null; then
pactl list short sink-inputs 2>&1 || true
echo
echo "-- vesktop stream state (Corked / Mute / Volume) --"
pactl list sink-inputs 2>&1 | grep -E "Sink Input|Sink:|Corked:|Mute:|Volume:|application\.(name|process\.binary)|media\.name" || true
fi
section "microphone sources the client reads"
if command -v pactl >/dev/null; then
pactl list short source-outputs 2>&1 || true
echo
echo "-- source output names --"
pactl list source-outputs 2>&1 | grep -E "Source Output #|Source:|application\.(name|process\.binary)|media\.name" || true
fi
section "client processes"
ps -eo pid,args 2>/dev/null | grep -iE "vesktop|electron" | grep -v grep || echo "no veskstop/electron process found"
section "pulse clients"
if command -v pactl >/dev/null; then
pactl list short clients 2>&1 || true
fi
section "daemon audio status"
if command -v curl >/dev/null; then
curl -sk "https://127.0.0.1:${PORT}/api/audio" || curl -s "http://127.0.0.1:${PORT}/api/audio"
echo
else
echo "curl is missing"
fi
section "bot identity"
if command -v curl >/dev/null; then
curl -sk "https://127.0.0.1:${PORT}/health" || curl -s "http://127.0.0.1:${PORT}/health"
echo
fi
section "bot voice state"
if command -v curl >/dev/null; then
curl -sk "https://127.0.0.1:${PORT}/api/voice" || curl -s "http://127.0.0.1:${PORT}/api/voice"
echo
fi
section "volumes: client output and per-user"
if command -v curl >/dev/null; then
curl -sk "https://127.0.0.1:${PORT}/api/voice/volume" || curl -s "http://127.0.0.1:${PORT}/api/voice/volume"
echo
fi
section "capture sink level for 5 seconds (talk during this)"
if command -v ffmpeg >/dev/null; then
ffmpeg -hide_banner -loglevel info -f pulse -i "veskslop_capture.monitor" -t 5 \
-af volumedetect -f null - 2>&1 | grep -E "mean_volume|max_volume" || true
else
echo "ffmpeg is missing"
fi
section "live events for 8 seconds (talk during this)"
if command -v curl >/dev/null; then
curl -skN --max-time 8 "https://127.0.0.1:${PORT}/api/events" 2>/dev/null \
| grep -E "VOICE_SPEAKING|VOICE_STATE_UPDATE" | head -10 || true
fi
printf '\nDaemon terminal lines to look for: [audio] moved stream, [capture] auto-start, ffmpeg errors.\n'