Last active
July 31, 2020 21:03
-
-
Save rhizoome/837cf267964af3a4669e3b91598c4274 to your computer and use it in GitHub Desktop.
Symmetric dmix and dnsoop for applications that process input/output synchronous (WebRTC, Chromium)
This file contains 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
#!/bin/sh | |
if [ -z "$1" ]; then | |
aplay -L | grep -v "^ " | cut -d ':' -f 2 | uniq | sort | uniq | |
exit 1 | |
fi | |
cat <<EOF > "$HOME/.asoundrc" | |
pcm.!default { | |
type asym | |
playback.pcm "dmixer" | |
capture.pcm "dsnooper" | |
} | |
pcm.dmixer { | |
type dmix | |
ipc_key 1024 | |
slave { | |
pcm "hw:$1" | |
period_time 0 | |
period_size 1024 | |
buffer_size 5120 | |
rate 48000 | |
} | |
bindings { | |
0 0 | |
1 1 | |
} | |
} | |
pcm.dsnooper { | |
type dsnoop | |
ipc_key 1025 | |
slave { | |
pcm "hw:$1" | |
period_time 0 | |
period_size 1024 | |
buffer_size 5120 | |
rate 48000 | |
} | |
bindings { | |
0 0 | |
1 1 | |
} | |
} | |
ctl.dmixer { | |
type hw | |
card $1 | |
} | |
ctl.dsnooper { | |
type hw | |
card $1 | |
} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment