Created
May 17, 2026 19:39
-
-
Save sharunkumar/b0937271c24d28c980f66f3f552c42a3 to your computer and use it in GitHub Desktop.
Use Android phone as mic via adb + scrcpy. Based off https://github.com/Genymobile/scrcpy/issues/4208
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| LATENCY=125 | |
| PIPE=/tmp/scrcpy_pipe | |
| MODULE_ID=$(pactl load-module module-pipe-source \ | |
| source_name="Scrcpy" channels=2 format=16 rate=48000 file="$PIPE") | |
| # keep the pipe flowing so scrcpy never blocks on write | |
| parec --fix-rate -d Scrcpy --raw > /dev/null & | |
| PAREC_PID=$! | |
| scrcpy --no-video --no-window --no-playback \ | |
| --audio-source=mic --audio-codec=raw \ | |
| --record-format=wav --record="$PIPE" \ | |
| --audio-buffer=$LATENCY --audio-output-buffer=10 | |
| kill $PAREC_PID 2>/dev/null || true | |
| pactl unload-module "$MODULE_ID" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment