Skip to content

Instantly share code, notes, and snippets.

@rhizoome
Last active July 31, 2020 21:03
Show Gist options
  • Save rhizoome/837cf267964af3a4669e3b91598c4274 to your computer and use it in GitHub Desktop.
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)
#!/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