Doesn anyone know how to create a virtual sound card in alsa?
I want to have a virtual card displayed when I run 'cat /proc/asound/cards'
I've looked at the alsa site, scoured the web... Hoping someone can point me in the right direction...
Creating virtual sound card
i'm not sure, but i think you would need to set up an alias in /etc/modprobe.conf ... though Puppy tends to reconfigure things every time it boots
you can set up as many virtual cards as you like in /etc/asound.conf or /root/.asoundrc, and they will be instantly available ... but they won't be listed in /proc/asound/cards
for example, you can set gxine or xmms to use whichever virtual card you like
for example, this might be a duplicate of your card 0, named "mycard":
pcm.mycard {
type hw
card 0
}
this would make the default sound card "mycard":
pcm.!default mycard
so if you typed this, mplayer would use mycard:
mplayer -ao alsa movie.avi
or you could select which card mplayer will use like this:
mplayer -ao alsa:device=mycard movie.avi
you can see what cards you have to choose from by typing:
aplay -L
if you have 4 speakers, you could create a virtual device that duplicates the sound in the front speakers and plays the sound in the rear speakers too:
pcm.40dup {
type route
slave.pcm surround40
slave.channels 4
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
}
you could play a movie using 40dup like this:
mplayer -ao alsa:device=40dup movie.avi
you could make "40dup" (or name it anything you like) the default sound card to use like this:
pcm.!default 40dup
you can set up as many virtual cards as you like in /etc/asound.conf or /root/.asoundrc, and they will be instantly available ... but they won't be listed in /proc/asound/cards
for example, you can set gxine or xmms to use whichever virtual card you like
for example, this might be a duplicate of your card 0, named "mycard":
pcm.mycard {
type hw
card 0
}
this would make the default sound card "mycard":
pcm.!default mycard
so if you typed this, mplayer would use mycard:
mplayer -ao alsa movie.avi
or you could select which card mplayer will use like this:
mplayer -ao alsa:device=mycard movie.avi
you can see what cards you have to choose from by typing:
aplay -L
if you have 4 speakers, you could create a virtual device that duplicates the sound in the front speakers and plays the sound in the rear speakers too:
pcm.40dup {
type route
slave.pcm surround40
slave.channels 4
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
}
you could play a movie using 40dup like this:
mplayer -ao alsa:device=40dup movie.avi
you could make "40dup" (or name it anything you like) the default sound card to use like this:
pcm.!default 40dup
That's unfortunate...GuestToo wrote: you can set up as many virtual cards as you like in /etc/asound.conf or /root/.asoundrc, and they will be instantly available ... but they won't be listed in /proc/asound/cards
Here's what I'm trying to accomplish.
On my server machine I have a music server called SlimServer (it indexes your music collections and gives you a slick web interface to control all the clients). I have several Squeeze boxes around the house (clients which play the streams from SlimServer) and I'm trying to set up several more audio zones on the cheap.
So I've got an old PC (running Puppy) with an onboard 4 channel soundcard which I have already split into 2 separate alsa devices.
The client software (which plays the slimserver stream) is a java application called SoftSqueeze. What I was planning on doing is running 2 instances of this application and assign each of the new alsa 2 channel pcm devices to each instance of the java app.
However, java donesn't play too nicely with alsa. All that java can address is actual devices that list in /proc/asound/cards. It can't address specific alsa pcm devices or dmix devices...
So I was hoping that by creating a virtual sound card, I could fool java into outputting to the proper outputs.