fix im um im

This commit is contained in:
legop3
2026-11-17 20:28:33 -05:00
parent 63b7255af7
commit 14f425744a
8 changed files with 39 additions and 9 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+14 -3
View File
@@ -9,7 +9,7 @@
exec ffmpeg -nostdin -f alsa -ar "$ROVER_AUDIO_SAMPLE_RATE" -ac "$ROVER_AUDIO_CHANNELS" -i "$ROVER_AUDIO_INPUT_DEVICE" -c:a libopus -b:a "$ROVER_AUDIO_BITRATE" -f rtsp -rtsp_transport tcp "$ROVER_AUDIO_PUBLISH_URL"
- id: aiy
name: Google AIY Voice HAT microphone
description: Same configurable ALSA route; setup enables the HAT overlay. Reboot once after first enabling its hardware.
description: HAT capture with S32_LE input, 20 dB microphone boost, and low-latency Opus settings. Reboot once after first enabling its hardware.
setup: |
set -euo pipefail
# Capture/playback setup may run concurrently; serialize edits to boot config.
@@ -30,8 +30,19 @@
if [[ "$changed" == 1 ]]; then
echo 'AIY hardware enabled. Reboot the host once before using this sound card.'
fi
if ! command -v ffmpeg >/dev/null || ! command -v aplay >/dev/null; then
if ! command -v ffmpeg >/dev/null || ! command -v arecord >/dev/null; then
apt-get update && apt-get install -y ffmpeg alsa-utils
fi
run: |
exec ffmpeg -nostdin -f alsa -ar "$ROVER_AUDIO_SAMPLE_RATE" -ac "$ROVER_AUDIO_CHANNELS" -i "$ROVER_AUDIO_INPUT_DEVICE" -c:a libopus -b:a "$ROVER_AUDIO_BITRATE" -f rtsp -rtsp_transport tcp "$ROVER_AUDIO_PUBLISH_URL"
# Preserve the HAT capture format, gain, and low-cost Opus settings.
arecord -D "$ROVER_AUDIO_INPUT_DEVICE" -f S32_LE \
-c "$ROVER_AUDIO_CHANNELS" -r "$ROVER_AUDIO_SAMPLE_RATE" \
-B "${AUDIO_ALSA_BUFFER_BYTES:-16384}" -F "${AUDIO_ALSA_PERIOD_BYTES:-1024}" -q -t raw |
ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer \
-rtbufsize 0 -thread_queue_size 4096 -f s32le \
-ar "$ROVER_AUDIO_SAMPLE_RATE" -ac "$ROVER_AUDIO_CHANNELS" -i pipe:0 \
-af "volume=20dB" -c:a libopus -b:a "$ROVER_AUDIO_BITRATE" \
-ar:a "$ROVER_AUDIO_SAMPLE_RATE" -ac:a "$ROVER_AUDIO_CHANNELS" \
-application audio -frame_duration 20 -compression_level 0 \
-flush_packets 1 -muxdelay 0 -muxpreload 0 \
-f rtsp -rtsp_transport tcp "$ROVER_AUDIO_PUBLISH_URL"
+7 -2
View File
@@ -11,7 +11,7 @@
exec ffmpeg -nostdin -rtsp_transport tcp -i "$ROVER_AUDIO_PLAYBACK_URL" -vn "${filters[@]}" -f alsa "$ROVER_AUDIO_OUTPUT_DEVICE"
- id: aiy
name: Google AIY Voice HAT speaker
description: Enables the HAT hardware; uses the same configured ALSA routing as other devices. Reboot once after initial setup.
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
# Capture/playback setup may run concurrently; serialize edits to boot config.
@@ -38,4 +38,9 @@
run: |
filters=()
if [ "$ROVER_AUDIO_NORMALIZE" = true ]; then filters=(-af "$ROVER_AUDIO_NORMALIZE_FILTER"); fi
exec ffmpeg -nostdin -rtsp_transport tcp -i "$ROVER_AUDIO_PLAYBACK_URL" -vn "${filters[@]}" -f alsa "$ROVER_AUDIO_OUTPUT_DEVICE"
# Decode to the same explicit HAT playback format as the previous listener.
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
+11 -3
View File
@@ -19,7 +19,15 @@
run: |
camera=$(command -v rpicam-vid || command -v libcamera-vid)
options=()
if [ "$ROVER_VIDEO_INVERTED" = true ]; then options+=(--hflip --vflip); fi
if [ "$ROVER_VIDEO_INVERTED" = true ]; then options+=(--rotation 180); fi
if [ -n "$ROVER_VIDEO_SENSOR_MODE" ]; then options+=(--mode "$ROVER_VIDEO_SENSOR_MODE"); fi
"$camera" --timeout 0 --nopreview --inline --codec h264 --width "$ROVER_VIDEO_WIDTH" --height "$ROVER_VIDEO_HEIGHT" --framerate "$ROVER_VIDEO_FPS" --bitrate "$ROVER_VIDEO_BITRATE" "${options[@]}" -o - |
ffmpeg -nostdin -fflags +genpts -f h264 -i pipe:0 -c:v copy -an -f rtsp -rtsp_transport tcp "$ROVER_VIDEO_PUBLISH_URL"
# Preserve the previous Pi publisher's camera tuning and packet timing.
"$camera" --inline --timeout 0 "${options[@]}" \
--width "$ROVER_VIDEO_WIDTH" --height "$ROVER_VIDEO_HEIGHT" \
--framerate "$ROVER_VIDEO_FPS" --bitrate "$ROVER_VIDEO_BITRATE" \
--codec h264 --intra 120 --profile baseline --denoise auto --nopreview \
--metering centre --ev 0.1 --awb auto --saturation 0.6 --brightness 0 --output - |
ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer \
-use_wallclock_as_timestamps 1 -f h264 -i pipe:0 -c:v copy -an \
-flush_packets 1 -muxdelay 0 -muxpreload 0 \
-f rtsp -rtsp_transport tcp "$ROVER_VIDEO_PUBLISH_URL"
+7 -1
View File
@@ -28,7 +28,13 @@ pcm.rover_mix {
type dmix
ipc_key 70601
ipc_key_add_uid true
slave { pcm %s format S16_LE rate %d channels %d }
# Preserve the previous mixer's explicit ALSA buffer geometry.
slave {
pcm %s format S16_LE rate %d channels %d
period_time 0
period_size 1024
buffer_size 4096
}
}
`, strconv.Quote(cfg.InputDevice), strconv.Quote(cfg.OutputDevice), cfg.OutputSampleRate, cfg.OutputChannels)
for _, pair := range [][2]string{{"tts", "TTSMaster"}, {"horn", "HornMaster"}, {"forward", "ForwardMaster"}} {