Mythbuntu 9.10 + PulseAudio + IEC958 (S/PDIF)

Mythbuntu 9.10 + PulseAudio + IEC958 (S/PDIF)

Setting up PulseAudio on Mythtbuntu 9.10 is really quite easy.
sudo apt-get install pulseaudio
All of the GUI tools should be installed along with it, but if they aren’t, pop this into your console:
sudo apt-get install pavumeter paman padevchooser paprefs
padevchooser is being deprecated, but it will be supported at least until Mythbuntu 11.04. The first thing you’ll want to do is launch padevchooser which will put an icon in your tray. From here, you can control all aspects of PulseAudio.

  1. Left-click the icon and select ‘Preferences’; click the checkbox next to ‘Start applet on session login’ and close the dialogue.
  2. Next, left-click the icon and select ‘Configure local sound server’; click the ‘Network Server’ tab and check the boxes next to ‘Enable network access to local sound devices’ and then ‘Don’t require authentication’. This allows applications to stream audio data direct to PulseAudio instead of through PulseAudio’s implementation of the ALSA API. This is necessary for all applications that support talking directly to PulseAudio.

Next, you’ll want to open the Volume Control from the tray icon menu and select your output device on the Configuration tab. PulseAudio should have enumerated all of the available combinations on your system, so choose the option you want. If you’re using optical output to your A/V receiver or television, choose digital, SPDIF or IEC958.

Setting up mpd for use with PulseAudio is straightforward. Open your /etc/mpd.conf file and comment out all the configuration related to alsa, then scroll down a bit and you should see a commented-out section related to PulseAudio. Make your config look like the below, and restart mpd.

# An example of an ALSA output:
#
#audio_output {
# type "alsa"
# name "My ALSA Device"
# device "hw:0,1" # optional
# format "44100:16:2" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
#}
audio_output {
type "pulse"
name "My Pulse Output"
# server "remote_server" # optional
# sink "remote_server_sink" # optional
}

Next, you’ll need to setup MythTV. This is pretty straightforward, all I did was go through the General settings to the audio options menu and set the following options:

Update! MythTV trunk supports PulseAudio, so all you need to do is select ‘PulseAudio:default’ as the audio output device.

  • Output:ALSA:plughw:0,1 (0,1 being the card id, device id key, obtainable through the command ‘aplay -l’; you may have something different in your setup but you can freely edit this text field for the correct device)
  • Passthrough output device: Default
  • Max audio channels: Stereo
  • Upmix: passive
  • Enable AC3 to SPDIF passthrough: no (force AC3 decoding by MythTV if your receiver can’t do it)
  • Enable DTS to SPDIF passthrough: yes (pass Dolby/DTS to your receiver, for DVDs)

And that’s it! All done. You should now have mpd and MythTV routable through PulseAudio which allows you to make use of the excellent projectM audio visualisation suite (basically an implementation of Milkdrop in OpenGL for Linux). Excellent for parties!

A note: This does actually output PCM 44.1Khz correctly. I was previously routing my audio through HDMI cable to the television, then from the television to the receiver. The TV was outputing a 48Khz signal; direct from the computer via optical, it’s a sweet 44.1Khz. Nice!