Skip to content

Instantly share code, notes, and snippets.

@KmolYuan
Last active September 18, 2023 19:19
Show Gist options
  • Save KmolYuan/f113809cc0341f3526df589cdb226841 to your computer and use it in GitHub Desktop.
Save KmolYuan/f113809cc0341f3526df589cdb226841 to your computer and use it in GitHub Desktop.
Microphone feedback on Linux.
#!/usr/bin/env bash
# Directs audio input (e.g. mic) to audio output (e.g. speakers),
# then sleeps forever. Stops audio redirection when it is killed.
# So, for example, plug your phone into the PC's mic, run 'listen',
# and listen to phone audio through your computer's speakers.
set -e
module=$(pactl load-module module-loopback latency_msec=50)
function cleanup {
pactl unload-module $module
}
trap cleanup EXIT
sleep infinity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment