The One with the Thoughts of Frans

Dolby Digital 5.1 over SP/DIF with PulseAudio in Debian Wheezy

Things are now significantly easier than they were a couple of years ago thanks primarily to improvements in PulseAudio.

Chances are you’ll have to create /etc/asound.conf. Stick this in it:

pcm.a52 {
	@args [CARD]
	@args.CARD {
		type string
        }
	type rate
	slave {
		pcm {   
			type a52
			card $CARD
		}
		rate 48000 #required somehow, otherwise nothing happens in PulseAudio
	}
}
pcm.pulse {
	type pulse
}
ctl.pulse {
	type pulse
}
pcm.!default {
	type pulse
}
ctl.!default {
	type pulse
}

In /etc/pulse/daemon.conf, add default-sample-rate = 48000 and enable-lfe-remixing = yes. Okay, you got me. That last one is just my preference, but why wouldn’t you want your subwoofer to do its thing?

pavucontrol is instrumental in quickly seeing what’s going on and for e.g. application-specific volume settings. Not utilizing it would be a disservice to yourself if you’ve chosen to use PulseAudio.

Now that we’ve got all the configuration set up you could reboot the computer, but one of the great things about Linux is that you rarely have to do that other than to load a different kernel. pulseaudio --kill should be enough to make everything fall into place a few seconds later.

For testing a good option is the surround test ac3 file from Lynne Music (straight to directory). You can play it with mplayer -channels 6 to make sure everything is working correctly and to adjust the channel map if necessary.

Various adjustments might still be required in some applications. For instance, in Totem you have to explicitly set audio output to 5.1 in Edit > Preferences > Audio.
For MPlayer you can put channels=6 in ~/.mplayer/config (note that if you can’t get PulseAudio to work you could add the equivalents of mplayer -ao alsa:device=spdif -srate 48000 -ac hwac3 file.avi if you so desire).
VLC works fine if Dolby Surround is set to Auto in Tools > Preferences > Audio.

On a separate note, I set PulseAudio up so it can play audio from all over my local network, most notably my laptop.

3 Comments

  1. […] post is from 2011 and relates to Debian Squeeze. I put up a newer post in 2013 when Debian Wheezy was […]

    August 20, 2013 @ 9:36Permalink
    Dolby Digital 5.1 Over S/PDIF With PulseAudio | The One with the Thoughts of Frans

  2. […] one of the headphones files without changing the entire system, but as luck would have it I use a digital IEC958 output for my main sound system, so I could afford mess up all handling of analog output for the sake of […]

    October 24, 2015 @ 18:56Permalink
    Working around the broken Creative HS-720 headset | The One with the Thoughts of Frans

  3. I’ve slightly changed my /etc/pulse/daemon.conf to make sure I get the best sound quality on a separate DAC, such as my Audioengine D1.

    
    resample-method = speex-float-10
    default-sample-format = s24le
    default-sample-rate = 96000
    ; these are just generic
    enable-lfe-remixing = yes
    flat-volumes = no
    

    Technically it can go up to 24/192, but that’s only over optical and it’s limited to 24/96 via USB. Seeing how I don’t have any audio like that it’s basically irrelevant to me regardless.

    PS Always disable flat volumes. It’s an idiotic novelty. http://fransdejonge.com/2015/10/pulseaudio-how-to-decouple-application-volumes-and-global-volume/

    PPS The src-sinc-best-quality resampler has been removed. I don’t really know if that’s good or bad, although it seems to have been done somewhat callously based only on the most common use case but the reason I haven’t opted for soxr-vhq is because it might add latency. See here and here.

    August 7, 2017 @ 16:28Permalink
    Frans

RSS feed for comments on this post· TrackBack URI

Leave a Comment

You must be logged in to post a comment.