PulseAudio: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{mininav|[[Audio]]}} | {{mininav|[[Audio]]|[[Linux audio]]}} | ||
In the past users have experienced problems with audio not working within XBMC, because they were running a full-blown Ubuntu desktop environment with PulseAudio installed. This happened because PulseAudio blocked the device XBMC required, and audio playback only worked reliably when using the virtual Pulse device. | In the past users have experienced problems with audio not working within XBMC, because they were running a full-blown Ubuntu desktop environment with PulseAudio installed. This happened because PulseAudio blocked the device XBMC required, and audio playback only worked reliably when using the virtual Pulse device. |
Revision as of 00:49, 22 March 2014
Audio | Linux audio | PulseAudio |
In the past users have experienced problems with audio not working within XBMC, because they were running a full-blown Ubuntu desktop environment with PulseAudio installed. This happened because PulseAudio blocked the device XBMC required, and audio playback only worked reliably when using the virtual Pulse device. Our workaround for those users has been to uninstall PulseAudio which completely broke desktop audio.
For XBMC 13 'Gotham' and later we wanted this situation to change, so thanks to the new PulseAudio Sink users now can run a normal Ubuntu desktop.
The PulseAudio Sink allows normal video & audio playback in XBMC while at the same time allowing the user to get audio in their browser or other applications. It also allows XBMC playback of video or audio to be paused in order to run a game, Skype or similar. XBMC only uses PulseAudio in case you have installed it and it is running.
PulseAudio Output Configuration
PulseAudio will be automatically detected and selected in XBMC when it is running.
PulseAudio can be run in one of two modes these are:
Passthrough Mode Used if you want to passthrough (bitstream) AC3, DTS, and EAC3 to an AVR or other device. In order to allow passthrough to work with PulseAudio then it MUST be set to use a 2.0 channel configuration, despite the 2.0 setting this will still allow 5.1 audio from AC3, DTS, and EAC3.
Note: PulseAudio does not currently allow TrueHD or DTS-MA passthrough, this is a PulseAudio limitation and not a limitation of the XBMC implementation.
Multichannel Mode
Used if you want Multichannel PCM out, in this mode you can configure PulseAudio for up to 7.1 channels. In this mode XBMC must decode all audio formats to PCM for passing onto the PulseAudio, this can have the advantage of improve audio/video sync.
Note: Audio decoded to PCM and sent through PulseAudio the audio will not likely be "bit perfect". Where a video has TrueHD 7.1 audio, this can be decoded by XBMC to PCM 7.1, however DTS-HD 7.1 audio can't be decoded by XBMC, only the embedded DTS Core 5.1 can be decoded to PCM 5.1 audio.
Setting up pavucontrol
Passthrough Mode
In order to activate Passthrough Codecs, just setup pavucontrol, as in the following:
If you like to do this from the command line, issue:
pactl set-sink-formats 0 "pcm; ac3-iec61937; dts-iec61937; eac3-iec61937"
Where 0 is the sink you want to alter. You can print all sinks, by using:
pactl list sinks
You can leave out the codecs your AVR does not support, always keep pcm.
Multichannel Mode
To configure instead Multi channel mode, do the following settings.
Example setup in xbmc
Setup Guide
PC Speakers 2.0 |
PC Speakers 5.1 |
TV SPDIF 2.0 |
TV SPDIF AC3 (1) |
AVR SPDIF AC3/DTS (2) |
AVR HDMI PCM (3) |
AVR HDMI No HD Audio (4) |
AVR HDMI Decode HD Audio (5) | |
---|---|---|---|---|---|---|---|---|
PusleAudio Mode | ||||||||
Multichannel | Multichannel | Multichannel | Passthrough | Passthrough | Multichannel | Passthrough | Multichannel | |
Pavucontrol - Output Devices | ||||||||
Port | Speakers | Speakers | Digital Output (S/PDIF) | Digital Output (S/PDIF) | Digital Output (S/PDIF) | HDMI/Displayport | HDMI/Displayport | HDMI/Displayport |
AC3 | N/A | N/A | Disabled | Enabled | Enabled | Disabled | Enabled | Disabled |
EAC3 | N/A | N/A | Disabled | Disabled | Disabled | Disabled | Enabled | Disabled |
DTS | N/A | N/A | Disabled | Disabled | Enabled | Disabled | Enabled | Disabled |
Pavucontrol - Configuration | ||||||||
Profile | Analog Stereo Output | Analog Surround 5.1 Output | Digital Stereo (IEC958) Output |
Digital Stereo (IEC958) Output |
Digital Stereo (IEC958) Output |
Digital Surround 5.1 (HDMI) Output |
Digital Stereo (HDMI) Output |
Digital Surround 7.1 (HDMI) Output |
XBMC Settings | ||||||||
Audio Output Device | Speakers | Speakers | SPDIF | SPDIF | SPDIF | HDMI | HDMI | HDMI |
Number of channels | 2.0 | 5.1 | N/A | N/A | N/A | 5.1 | 2.0 | 7.1 |
Enabled passthrough | Disabled | Disabled | Disabled | Enabled | Enabled | Disabled | Enabled | Disabled |
Passthrough output device | N/A | N/A | N/A | SPDIF | SPDIF | N/A | HDMI | N/A |
Dolby Digital (AC3) capable receiver | N/A | N/A | N/A | Enabled | Enabled | Disabled | Enabled | Disabled |
Enabled Dolby Digital transcoding | N/A | N/A | N/A | Enabled | Enabled | Disabled | Enabled | Disabled |
DTS capable receiver | N/A | N/A | N/A | Disabled | Enabled | Disabled | Enabled | Disabled |
TrueHD capable receiver | N/A | N/A | N/A | Disabled | Disabled | Disabled | Disabled | Disabled |
DTS-HD capable receiver | N/A | N/A | N/A | Disabled | Disabled | Disabled | Disabled | Dsiabled |
(1) Where TV can decode 5.1 AC3.
(2) Where AVR only has SPDIF which will support 5.1 AC3 & DTS.
(3) Where AVR can do 5.1 PCM.
(4) Where AVR has HDMI inputs but can't decode TrueHD or DTS-HD but does support 5.1 Ac3 or DTS.
(5) Where AVR has full decode capabilities including 7.1 PCM.
Combined Output aka dual audio
If you want to output to all your attached devices in parallel, e.g. HDMI out, analog out and USB sound card, it is enough to do as below:
Step 1: Edit /etc/pulse/default.pa
load-module module-combine-sink sink_name=combined
Step 2: Restart pulseaudio.
killall pulseaudio
xbmc will then pickup the device, it is named combined.
Audiophile Pulse User
Pulseaudio resamples everything that does not match the underlaying sink, so if you are an audiophile user, you perhaps want to hear your 96 / 192 khz and 24 bit recordings as exact as possible. Therefore you need to tell pulseaudio to use a better resampler in general and second change the default sample rate to 96 or 192 khz. Pulseaudio does not resample audio, that is already in the correct samplerate. Furthermore you need to take care, that your sink has a wide enough output format.
To do this configuration systemwide (96 khz in that example), change /etc/pulse/daemon.conf to include (please replace already existing lines and also remove the commenting):
default-sample-format = s32le default-sample-rate = 96000 resample-method = speex-float-5
The last setting will increase the resample quality from pulse and therefore the CPU load quite a lot. Again: Resampling is only done, when the sink output does not match the data you throw onto it. But as most normal mp3s are in 44.1 khz, you need to take great care when upsampling them. The overwriting of the resample-method is for this use case.
FAQ
| ||||
| ||||
| ||||
|
Known issues
Whenever the PulseAudio Sink is unloaded, the stream is completely destructed and created newly. This will reset the stream's volume to the internal xbmc volume. This is only an issue if you use "external volume", e.g. you use pavucontrol and change the stream volume via slider. This only affects the current running stream as xbmc gets no knowledge about it. Best is: use xbmc's internal volume or change the global volume only.
References
Linux - Pulseaudio Sink Discussion and further information. |