dotfiles/scripts/sboard
2022-03-28 20:20:45 -04:00

13 lines
606 B
Bash
Executable File

#!/bin/bash
default=$(pactl info | grep "Default Source:" | sed 's/Default Source: //g')
sink=$(pactl info | grep "Default Sink:" | sed 's/Default Source: //g')
pipe=$(pactl load-module module-pipe-source source_name=sboard file="${XDG_DATA_HOME}/sboard/vmic" format=s16le rate=16000 channels=1)
redir=$(pactl load-module module-loopback source=sboard sink="$sink")
pactl set-default-source sboard
pactl set-source-volume sboard 100%
ffmpeg -y -re -i "$@" -f s16le -ar 16000 -ac 1 "${XDG_DATA_HOME}/sboard/vmic"
pactl set-default-source "$default"
pactl unload-module "$pipe"
pactl unload-module "$redir"