You are not logged in.

#1 2013-05-10 07:46:50

vyu223
Member
Registered: 2013-02-18
Posts: 22

Downmixing 8 channel (7.1) audio to stereo with ALSA

I have a USB DAC that only accepts 16 bit, 44.1kHz stereo audio. Consulting the Arch ALSA wiki page, my /etc/asound.conf is as so:

defaults.pcm.rate_converter "samplerate_best"
pcm.!surround51 {
	type vdownmix
	slave.pcm "default"
}
pcm.!surround40 {
	type vdownmix
	slave.pcm "default"
}

I have the alsa-plugins and libsamplerate packages installed. Due to my DAC's limitation, I cannot pass the audio bit-perfectly to it; processing must be done. But I want high quality mixing, since I have the CPU cycles to spare. According to /usr/share/doc/alsa-plugins/ vdownmix is limited to downmixing 4 to 6 channels:

VDOWNMIX PLUGIN
===============

The vdownmix plugin is a downmixer from 4-6 channels to 2-channel
stereo headphone output.  This plugin processes the input signals with
a simple spacialization, so the output sounds like a kind of "virtual
surround".

For example, define the below:

	pcm.!surround51 {
		type vdownmix
		slave.pcm "default"
	}
	pcm.!surround40 {
		type vdownmix
		slave.pcm "default"
	}

and the outputs from video player to these PCMs are converted to the
default 2.0 output with a proper downmix.

The accepted format is currently only S16.

So the thing is, I have some movies that have 24 bit, 48kHz 8 channel (7.1) audio that I want to play. With my current configuration, I cannot hear the actors' voices, so I suspect that two or more channels (including the center channel, which contains the voice track) are being discarded. Here are the notable lines from my /etc/mplayer/mplayer.conf:

a52drc=0 #(default: 1) 0 disables dynamic range compression
channels=8
volume=100
softvol-max=100.0
volstep=100 #control volume only through external power amplifier
ao=alsa:device=default

I tried searching around on Google, but it seems that more people are concerned about upmixing stereo to 7.1. Anything related to downmixing is limited to 5.1 and below.
Edit: Clarification: I can't get 8 channel downmixing to work properly. What am I doing wrong?

Last edited by vyu223 (2013-05-10 07:51:35)

Offline

#2 2013-05-10 08:43:00

brebs
Member
Registered: 2007-04-03
Posts: 3,439

Re: Downmixing 8 channel (7.1) audio to stereo with ALSA

See "downmix_51to20" in the ALSA config in my sig.

I'm sure you can adapt it from 5.1 to 7.1 wink

Offline

#3 2013-05-12 07:28:18

vyu223
Member
Registered: 2013-02-18
Posts: 22

Re: Downmixing 8 channel (7.1) audio to stereo with ALSA

Sorry, left town for a couple of days. Won't be able to access my machine to try the changes. Before I left, I changed some lines in mplayer.conf to 'channels=6' and changed the alsa device from "default" to "surround51". I assume that "default" expects only two channels? And truncates any additional channels? I couldn't find this in the documention. Anyway, now lots of postprocessing is occurring. Ugh. I really wish I had a better DAC that I could just feed a bit-perfect stream and have it downmix through hardware.

But yeah, I looked at your config. Lots of code! It's a good thing I took some C. Now just to refer to the docs... But I generally get the gist of it. I have to change some things in the code block for "dmixed"... And really think about how this kind of configuration would compare with the one I currently have right now with my most recent change as described above in this post.

Edit: 2 more things.

I'm curious as to whether mplayer downmixes additional channels if for '"channels=n", n < number of channels from source (movie). Or does it just truncate additional channels? I'll have to do a listening test when I get back home.

My other concern, which I can't seem to figure out myself, is what to set "--mixer" as. On the mplayer man page, it says, "Use a mixer device different from the default /dev/mixer. For ALSA this is the mixer name." Googling 'alsa mixer name' just gives me results for alsamixer. And I assume that /dev/mixer is for OSS. I want the best possible quality, as is suggested on the Arch ALSA wiki page. What should I put as --mixer?

Last edited by vyu223 (2013-05-12 07:39:17)

Offline

#4 2013-05-12 08:01:08

brebs
Member
Registered: 2007-04-03
Posts: 3,439

Re: Downmixing 8 channel (7.1) audio to stereo with ALSA

Yes, "default" is stereo, only the first 2 channels are used. Is defined in /usr/share/alsa/

That "mixer" (/dev/mixer*) is for OSS rather than ALSA - ignore.

Offline

Board footer

Powered by FluxBB