Files
MultiRoombaRover/rover/profiles/audioPlayback.yaml
T
2026-11-17 21:06:47 -05:00

45 lines
2.2 KiB
YAML

- id: alsa
name: ALSA speaker
description: Uses the configured output alongside TTS and horn with independent volume controls.
setup: |
apt-get update && apt-get install -y ffmpeg alsa-utils
run: |
normalize=true
normalize_filter='dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled'
filters=()
if [ "$normalize" = true ]; then filters=(-af "$normalize_filter"); fi
ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer -flags low_delay \
-analyzeduration 200k -probesize 32k -rtsp_transport tcp -i "$ROVER_AUDIO_PLAYBACK_URL" \
-vn "${filters[@]}" -ac 1 -ar 16000 -f s16le pipe:1 |
aplay -q -D "$ROVER_AUDIO_OUTPUT_DEVICE" -t raw -f S16_LE -r 16000 -c 1
- id: aiy
name: Google AIY Voice HAT speaker
description: HAT playback with low-latency decoding and 16 kHz mono output through the configured audio route. Reboot once after initial setup.
setup: |
set -euo pipefail
boot=/boot/firmware/config.txt
[[ -f "$boot" ]] || boot=/boot/config.txt
[[ -f "$boot" ]] || { echo 'AIY setup needs a Raspberry Pi boot config.txt' >&2; exit 1; }
changed=0
for setting in dtparam=i2s=on dtoverlay=googlevoicehat-soundcard; do
if ! grep -Fxq "$setting" "$boot"; then
# Leave any model-specific section before adding shared HAT settings.
if [[ "$changed" == 0 ]]; then printf '\n[all]\n' >> "$boot"; fi
printf '%s\n' "$setting" >> "$boot"
changed=1
fi
done
if [[ "$changed" == 1 ]]; then
echo 'AIY hardware enabled. Reboot the host once before using this sound card.'
fi
apt-get update && apt-get install -y ffmpeg alsa-utils
run: |
normalize=true
normalize_filter='dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled'
filters=()
if [ "$normalize" = true ]; then filters=(-af "$normalize_filter"); fi
ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer -flags low_delay \
-analyzeduration 200k -probesize 32k -rtsp_transport tcp -i "$ROVER_AUDIO_PLAYBACK_URL" \
-vn "${filters[@]}" -ac 1 -ar 16000 -f s16le pipe:1 |
aplay -q -D "$ROVER_AUDIO_OUTPUT_DEVICE" -t raw -f S16_LE -r 16000 -c 1