refactor: improve Docker speech container audio configuration and user permissions

- Update Dockerfile to enhance audio setup and user management
- Modify setup-audio.sh to add robust PulseAudio socket and device checks
- Add proper user and directory permissions for audio and model directories
- Simplify container startup process and improve audio device detection
This commit is contained in:
jango-blockchained
2025-02-05 03:30:15 +01:00
parent 10e895bb94
commit 942c175b90
3 changed files with 41 additions and 22 deletions

View File

@@ -1,7 +1,25 @@
#!/bin/bash
# Wait for PulseAudio to be ready
sleep 2
# Wait for PulseAudio socket to be available
while [ ! -e /run/user/1000/pulse/native ]; do
echo "Waiting for PulseAudio socket..."
sleep 1
done
# Test PulseAudio connection
pactl info || {
echo "Failed to connect to PulseAudio server"
exit 1
}
# List audio devices
pactl list sources || {
echo "Failed to list audio devices"
exit 1
}
# Start the wake word detector
python /app/wake_word_detector.py
# Mute the monitor to prevent feedback
pactl set-source-mute alsa_output.pci-0000_00_1b.0.analog-stereo.monitor 1