#!/bin/bash NAME="${1:-recording}" OUT_DIR="$HOME/recordings" # Ensure the recordings directory exists mkdir -p "$OUT_DIR" # Background routine to poll ports and link them natively via PipeWire ( for i in {1..20}; do if pw-link -i | grep -q "rec:input_1" && pw-link -i | grep -q "rec:input_2"; then pw-link SuperCollider:out_1 rec:input_1 pw-link SuperCollider:out_2 rec:input_2 exit 0 fi sleep 0.1 done echo "Warning: Timed out waiting for JACK ports." >&2 )& pw-jack ffmpeg -f jack -i rec -c:a libopus -b:a 256k -af "afade=t=in:ss=0:d=5" -y "$OUT_DIR/$(date +%s)_${NAME}.opus" #FLAC pw-jack ffmpeg -f jack -i rec -af "afade=t=in:ss=0:d=5" -y "$OUT_DIR/$(date +%s)_${NAME}.flac"