From 0590b8b07d842bea8a5cae68d5152f36b93da7a2 Mon Sep 17 00:00:00 2001 From: Natalie Date: Sun, 17 May 2026 20:15:44 -0700 Subject: [PATCH] =?UTF-8?q?fix(@scripts):=20=F0=9F=90=9B=20update=20audio?= =?UTF-8?q?=20input=20to=20use=20configurable=20device?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- bin/rvoice | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bin/rvoice b/bin/rvoice index b02326e..652cc39 100755 --- a/bin/rvoice +++ b/bin/rvoice @@ -28,6 +28,10 @@ # RVOICE_AUTOSEND=1 (append Enter; default 0) # RVOICE_MIN_MS=200 (ignore taps shorter than this) # RVOICE_MAX_S=60 (hard cap on recording length) +# RVOICE_AUDIO_INPUT=":default" (avfoundation input; numeric +# index or "default". List devices +# with: ffmpeg -f avfoundation +# -list_devices true -i "") # # State lives in $TMPDIR/rvoice/ — one recording at a time. @@ -42,6 +46,10 @@ LANG_HINT=${RVOICE_LANG:-en} AUTOSEND=${RVOICE_AUTOSEND:-0} MIN_MS=${RVOICE_MIN_MS:-200} MAX_S=${RVOICE_MAX_S:-60} +# avfoundation input spec. ":default" → macOS system default input +# (controlled via Sound Settings / Control Center → Sound). Numeric ":N" +# pins to a specific device index from `ffmpeg -f avfoundation -list_devices`. +AUDIO_INPUT=${RVOICE_AUDIO_INPUT:-:default} STATE_DIR=${TMPDIR:-/tmp}/rvoice mkdir -p "$STATE_DIR" @@ -111,10 +119,11 @@ cmd_start() { _start_ts=$(now_ms) printf '%s' "$_start_ts" > "${START_FILE}.tmp" mv -f "${START_FILE}.tmp" "$START_FILE" - # 16kHz mono PCM, capped at MAX_S. Device "0" is the default macOS input; - # change with AVFoundation list if you have multiple mics. + # 16kHz mono PCM, capped at MAX_S. AUDIO_INPUT defaults to ":default" + # which honors the macOS system default input (configurable via Sound + # Settings / Control Center). Numeric ":N" pins a specific device. nohup ffmpeg -hide_banner -loglevel error -nostdin \ - -f avfoundation -i ":0" \ + -f avfoundation -i "$AUDIO_INPUT" \ -ac 1 -ar 16000 -t "$MAX_S" \ -y "$WAV_FILE" >/dev/null 2>>"$LOG_FILE" & echo $! > "$PID_FILE"