Skip to content

Instantly share code, notes, and snippets.

@Enzime
Created October 27, 2015 17:07
Show Gist options
  • Save Enzime/8185dc1ae13e31b442ef to your computer and use it in GitHub Desktop.
Save Enzime/8185dc1ae13e31b442ef to your computer and use it in GitHub Desktop.
ALSA config for custom recording device (that also outputs to speakers)
# create default device, outputs to just audio out
pcm.!default {
type asym
playback.pcm "plug:dmix0"
capture.pcm "dsnoop:PCH"
}
# outputs to both audio out and loopback
pcm.record {
type asym
playback.pcm "plug:both"
capture.pcm "dsnoop:Loopback,1"
}
# software mixer for audio out
pcm.dmix0 {
type dmix
ipc_key 1024
slave {
pcm "hw:PCH"
period_size 256
buffer_size 1280
}
}
# software mixer for loopback
pcm.dmix1 {
type dmix
ipc_key 2048
slave {
pcm "hw:Loopback"
period_size 256
buffer_size 1280
}
}
# plays to both audio out and loopback
pcm.multi {
type multi
slaves {
a { pcm "dmix0" channels 2 }
b { pcm "dmix1" channels 2 }
}
bindings {
0 { slave a channel 0 }
1 { slave a channel 1 }
2 { slave b channel 0 }
3 { slave b channel 1 }
}
}
# magic routing???
pcm.both {
type route
slave.pcm "multi"
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment