Add audio troubleshooting tools and documentation

Added fix_talkkonnect_audio.sh diagnostic script:
- Checks PipeWire/PulseAudio session availability
- Lists all audio devices (ALSA, PulseAudio/PipeWire)
- Shows current talkkonnect audio configuration
- Provides specific recommendations for audio issues
- Includes test commands for verifying audio

Updated TALKKONNECT_SETUP.md:
- Added "Common Warnings (Usually Non-Fatal)" section
- Explains "Unable to Unmute" error (cosmetic, audio usually works)
- Explains "Unable to Find Channel Name" warning
- Explains "Failed to connect PipeWire event context" error
- Added reference to audio diagnostic script
- Included quick audio test commands

These help users understand that common errors like "Unable to Unmute"
are non-fatal and audio typically works despite the warnings.
This commit is contained in:
Claude
2025-11-23 12:45:17 +00:00
parent f56f0be57a
commit 10a73fc6d4
2 changed files with 169 additions and 0 deletions
+40
View File
@@ -226,6 +226,46 @@ curl http://localhost:8011/api/channel?channel=General/Support
## Troubleshooting
### Common Warnings (Usually Non-Fatal)
These warnings often appear but don't prevent talkkonnect from working:
**`Unable to Unmute failed to execute "pactl set-sink-mute 0 0"`**
- TalkKonnect is trying to unmute your audio output
- This usually fails because the sink index is wrong or pactl isn't accessible
- **Audio typically works anyway** - this is just a cosmetic error
- To fix: Run `./fix_talkkonnect_audio.sh` to check your audio configuration
**`Unable to Find Channel Name: Root`**
- Just a warning - connection usually succeeds anyway
- The channel exists but talkkonnect didn't detect it during initial scan
- You'll see a follow-up message showing successful connection
**`Failed to connect PipeWire event context (errno: 112)`**
- TalkKonnect is trying to use PipeWire but can't access the session
- Usually happens when running as a service without proper environment
- **If you see `Speaking ->` messages, audio is working!**
- To fix: Ensure XDG_RUNTIME_DIR is set correctly in systemd service
### Audio Troubleshooting
Run the audio diagnostic script:
```bash
./fix_talkkonnect_audio.sh
```
This will:
- Check PipeWire/PulseAudio session status
- List available audio devices
- Show current talkkonnect configuration
- Provide specific recommendations
**Quick audio test:**
```bash
# Test as the kiosk user (replace with your user)
sudo -u kiosk XDG_RUNTIME_DIR=/run/user/$(id -u kiosk) speaker-test -t wav -c 2 -l 1
```
### View Logs
```bash
+129
View File
@@ -0,0 +1,129 @@
#!/usr/bin/env bash
# ======================================================================
# File: fix_talkkonnect_audio.sh
# Purpose: Fix talkkonnect audio configuration
# ======================================================================
echo "======================================================================="
echo "TalkKonnect Audio Configuration Fix"
echo "======================================================================="
echo ""
# Prompt for target user
read -p "Which user is talkkonnect running as? [kiosk]: " TARGET_USER
TARGET_USER=${TARGET_USER:-kiosk}
# Verify the target user exists
if ! id "$TARGET_USER" &>/dev/null; then
echo "[!] Error: User '$TARGET_USER' does not exist"
exit 1
fi
TARGET_UID=$(id -u "$TARGET_USER")
TARGET_HOME=$(eval echo ~"$TARGET_USER")
CONFIG_FILE="$TARGET_HOME/.config/talkkonnect/talkkonnect.xml"
echo "[+] Target user: $TARGET_USER (UID: $TARGET_UID)"
echo "[+] Config file: $CONFIG_FILE"
echo ""
# Check PipeWire session
echo "[1] Checking PipeWire/PulseAudio session..."
if [ -S "/run/user/$TARGET_UID/pipewire-0" ]; then
echo " ✓ PipeWire socket found: /run/user/$TARGET_UID/pipewire-0"
HAS_PIPEWIRE=true
else
echo " ✗ No PipeWire socket found at /run/user/$TARGET_UID/pipewire-0"
HAS_PIPEWIRE=false
fi
if [ -S "/run/user/$TARGET_UID/pulse/native" ]; then
echo " ✓ PulseAudio socket found: /run/user/$TARGET_UID/pulse/native"
HAS_PULSE=true
else
echo " ✗ No PulseAudio socket found"
HAS_PULSE=false
fi
echo ""
# Check audio devices as target user
echo "[2] Checking audio devices for user $TARGET_USER..."
echo ""
echo "Available ALSA output devices:"
sudo -u "$TARGET_USER" XDG_RUNTIME_DIR=/run/user/$TARGET_UID aplay -L 2>/dev/null | grep -E "^(default|hw:|pulse)" | head -10
echo ""
echo "Available ALSA input devices:"
sudo -u "$TARGET_USER" XDG_RUNTIME_DIR=/run/user/$TARGET_UID arecord -L 2>/dev/null | grep -E "^(default|hw:|pulse)" | head -10
echo ""
# If PipeWire/Pulse is available, check sinks
if [ "$HAS_PIPEWIRE" = true ] || [ "$HAS_PULSE" = true ]; then
echo "PipeWire/PulseAudio sinks:"
sudo -u "$TARGET_USER" XDG_RUNTIME_DIR=/run/user/$TARGET_UID pactl list sinks short 2>/dev/null || echo "(pactl not available)"
echo ""
echo "PipeWire/PulseAudio sources:"
sudo -u "$TARGET_USER" XDG_RUNTIME_DIR=/run/user/$TARGET_UID pactl list sources short 2>/dev/null || echo "(pactl not available)"
echo ""
fi
# Check current config
echo "[3] Current talkkonnect audio configuration:"
if [ -f "$CONFIG_FILE" ]; then
echo ""
echo "Input device:"
grep -A1 '<input>' "$CONFIG_FILE" | grep 'device=' | sed 's/.*device="\([^"]*\)".*/ \1/'
echo ""
echo "Output device:"
grep -A1 '<output>' "$CONFIG_FILE" | grep 'device=' | sed 's/.*device="\([^"]*\)".*/ \1/'
echo ""
else
echo " Config file not found!"
exit 1
fi
# Recommendations
echo "======================================================================="
echo "Recommendations"
echo "======================================================================="
echo ""
if [ "$HAS_PIPEWIRE" = false ] && [ "$HAS_PULSE" = false ]; then
echo "⚠️ No PipeWire or PulseAudio session found"
echo ""
echo "Option 1: Use direct ALSA (best for dedicated audio hardware)"
echo " Edit $CONFIG_FILE"
echo " Change both input and output device to: hw:0,0"
echo ""
echo "Option 2: Start PipeWire for the $TARGET_USER user"
echo " Ensure $TARGET_USER has an active graphical session"
echo ""
else
echo "✓ Audio system detected (PipeWire/PulseAudio)"
echo ""
echo "The 'Unable to Unmute' error is usually non-fatal."
echo "If audio is working, you can ignore it."
echo ""
echo "To fix the unmute error, you can:"
echo " 1. Keep device as 'default' (usually works)"
echo " 2. OR use specific device like 'pulse' or 'hw:0,0'"
echo ""
fi
echo "Testing audio output as $TARGET_USER:"
echo " sudo -u $TARGET_USER XDG_RUNTIME_DIR=/run/user/$TARGET_UID speaker-test -t wav -c 2 -l 1"
echo ""
echo "Testing audio input as $TARGET_USER:"
echo " sudo -u $TARGET_USER XDG_RUNTIME_DIR=/run/user/$TARGET_UID arecord -d 3 -f cd test.wav && aplay test.wav"
echo ""
echo "To edit config:"
echo " sudo nano $CONFIG_FILE"
echo ""
echo "After making changes, restart talkkonnect:"
echo " sudo systemctl restart talkkonnect"
echo ""