I was about to give up after googling for how to get something like virtual surround on Linux when I "discovered" a plugin for ALSA called
vdownmix. It downmixes 4.0 or 5.1 audio to create a virtual surround effect on stereo headphones.
A good kept secret? Probably not, it's in the official
ALSA plugins package after all. But why does it seem like nobody is using it (
google)?
How to:
I'm using ALSA 1.0.14, and the vdownmix plugin was introduced with ALSA 1.0.11, according to the changelogs. To make use of it, you'll have to install the plugins that ALSA ships first of course. The package in question should be called
alsa-plugins, at least it does on the Red Hat- and Debian-style distros I use. Look for it in your package manager.
The documentation is surprisingly simple. Add the following to your
~/.asoundrc or /etc/asound.conf (create the file if it doesn't exist yet):
pcm.!surround51 {
type vdownmix
slave.pcm "default"
}
pcm.!surround40 {
type vdownmix
slave.pcm "default"
}
This will create two new sound devices that can be used by applications just as they would use your sound card directly, with the exception that these two process the audio through the vdownmix plugin. Yes, it
should work with all ALSA-compatible apps, but they've got to be able to use 5.1 or 4.0 surround sound to benefit from it.
If you need to use a card other than the default sound device (like for using a USB headset), change the two
slave.pcm "default" lines to
slave.pcm "devicename", where
devicename can be something like
hw:0 for the first soundcard,
hw:1 for the second, and so on. It can also be some other PCM device like
dmix:CARD=1 (to use the second sound card through dmix).
Plug in your headphones and off you go: play something like a DVD with 5.1 audio in mplayer:
mplayer -ao alsa -channels 6 dvd://1
There's no need to tell mplayer to use the device since it uses surround51 automatically if 6 channels are available. If you use a frontend for mplayer (such as
SMPlayer), just tell it to use "alsa" for sound output and add
-channels 6 to the mplayer command parameters.
Xine's default surround devices (so also Amarok's, Kaffeine's, etc.),
plug:surround51:0 and
plug:surround40:0, wouldn't work for me. Here you'll have to set your frontends to use
plug:surround51 and
plug:surround40 instead.
(no, mp3s are usually not in surround nor using more than 2 channels, so you can't test Amarok with them)
You can also test it with the
speaker-test utility (usually in package
alsa-utils,
speaker-test in Mandriva):
speaker-test -D surround51 -c 6
As for the effect itself, I think it does indeed give a nice surround effect. And yes, maybe that's just me being ignorant and I fail to realize that it actually sounds crappy. Therefor I won't make any promises and leave it to you to judge whether it's for you or not, but I recommend to at least give it a try with a movie or two.
Troubleshooting:
Now something I encountered while using vdownmix with my USB headset was that clipping occured because of too high playback volume. So I had to put softvol into the chain:
pcm.!downmix51 {
type vdownmix
slave.pcm "default"
}
pcm.!downmix40 {
type vdownmix
slave.pcm "default"
}
pcm.!surround51 {
type softvol
slave.pcm "downmix51"
control.name "Virtual Surround 5.1 Downmix"
control.card 1
}
pcm.!surround40 {
type softvol
slave.pcm "downmix40"
control.name "Virtual Surround 4.0 Downmix"
control.card 1
}
This may not be necessary for other people. You'll know whether you need it or not if your sound seems more distorted during volume peeks when using vdownmix. Decrease the new volume control's level to around 50% and all clipping should be gone (it was for me). Reducing the card's Master volume didn't help for me.
What's a bit bothersome about softvol however is that you first have to play something through the device it controls before the system recognizes the control (also mentioned on the inofficial
ALSA Wiki. So play something first through vdownmix, then restart your mixer (alsamixer, kmix, kalsamix, etc.) and adjust the volume.
Happy listening!
Monday, July 13. 2009 at 13:34 (Link) (Reply)
Saturday, July 25. 2009 at 22:33 (Reply)
Any help please ?