View previous topic :: View next topic |
Author |
Message |
chainsawbike Tux's lil' helper
Joined: 27 Dec 2007 Posts: 78 Location: the great new zealand
|
Posted: Mon Nov 21, 2011 12:45 am Post subject: [HOWTO]clone sound output to 2 devices using alsa |
|
|
this sets alsa to output stereo sound to 2 hardware devices ( a usb headset "Headset" and an onboard chip "SB" )
/etc/asound.conf:
Code: |
# sets default "volume control" device to the headset
ctl.!default {
type hw
#see notes at bottom under the control section about this setting
card "Headset"
}
# sets the default output device to the "pcm.both" device
pcm.!default both
# the fun begins...
pcm.both {
#add the software volume control plugin to the chain first - creates a volume control for "everything" fed into the default alsa device
type softvol
slave {
pcm {
# add the plug plugin, the "Automatic conversion plugin" - allows a 2 channel source to feed what is technically a 4 channel plugin
type plug
slave {
pcm {
# add the route plugin - used to rearrange the channels
type route
slave {
pcm {
# add the multi plugin - used to merge the 2 sound cards together
type multi;
slaves.a.pcm{
# add the dmix plugin - needed for multiple input into one hardware card if the card does not support hardware mixing
type dmix
# if i mess with this it doesn't work (and yes i made it up)?!
ipc_key 2589455
#needed for multiple users accessing the sound card at the same time
ipc_perm 0666
slave {
pcm {
# add the "SB" card - change to suit your sound card #1
type hw
card SB
device 0
}
buffer_size 4096
channels 2
}
}
slaves.b.pcm{
type dmix
ipc_key 4855689
ipc_perm 0666
slave {
pcm {
#add the "Headset"sound card - change to suit your sound card #2
type hw
card Headset
device 0
}
buffer_size 4096
channels 2
}
}
# this creates a 4 channel stream using 2 inputs from each card
slaves.a.channels 2;
slaves.b.channels 2;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave b;
bindings.2.channel 0;
bindings.3.slave b;
bindings.3.channel 1;
}
}
#this merges channel 2 and 3 into 0 and 1 respectively
ttable.0.0 1;
ttable.1.1 1;
ttable.0.2 1;
ttable.1.3 1;
}
}
}
}
control{
# define volume control name - i used master on Headset as my Headset did not create one and most ( of my ) apps try to change "Master" by default
# if you already have a "Master" volume control you will need to name it something else
name Master
# the card used to add the software control to - used for accessing the control does not affect the output of that card directly ( ie it changes the output of both devices just shows up in the one selected )
# you also will need to change the device set in the first block (ctl.!default) to the same card to ensure it is chosen as the default
card Headset
}
}
|
[EDIT] added/rearranged stuff and added a "master" volume control
Last edited by chainsawbike on Tue Nov 22, 2011 7:49 am; edited 1 time in total |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Mon Nov 21, 2011 12:41 pm Post subject: |
|
|
Sounds ( ) interesting but mind explaining what all those cryptic symbols actually do? I for one had no idea that could be done with ALSA. Least I could say is that I never touch ALSA configuration; understand what is done is one thing, improvise and start doing something with it is quite different... _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
chainsawbike Tux's lil' helper
Joined: 27 Dec 2007 Posts: 78 Location: the great new zealand
|
Posted: Tue Nov 22, 2011 7:53 am Post subject: |
|
|
ive attempted to explain it better - not one of my greatest skills though |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Fri Nov 25, 2011 2:50 pm Post subject: |
|
|
Great! Thanks a lot! _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
|