PulseAudio: Difference between revisions
m (Formatting) |
|||
Line 15: | Line 15: | ||
}}</center> | }}</center> | ||
<br> | <br> | ||
== | == Outline == | ||
In the past, XBMC had immense problems with '''users not getting audio''', because they had a full blown Ubuntu desktop environment with '''pulseaudio installed'''. | In the past, XBMC had immense problems with '''users not getting audio''', because they had a full blown Ubuntu desktop environment with '''pulseaudio installed'''. | ||
Line 25: | Line 25: | ||
Users that run '''a normal Ubuntu desktop''' and just use xbmc for normal '''video <big> &</big> audio playback''' while also wanting audio in parallel in their browser or pause xbmc, run a game or rhythmbox / Skype or similar now use our new '''PulseAudio Sink''' when using XBMC Gotham builds. XBMC only uses pulseaudio because you have installed it and it is running. | Users that run '''a normal Ubuntu desktop''' and just use xbmc for normal '''video <big> &</big> audio playback''' while also wanting audio in parallel in their browser or pause xbmc, run a game or rhythmbox / Skype or similar now use our new '''PulseAudio Sink''' when using XBMC Gotham builds. XBMC only uses pulseaudio because you have installed it and it is running. | ||
== | == Introduction == | ||
The pulseaudio sink automatically detects if pulseAudio is running and <u>'''so'''</u> assumes that the user, has installed pulseaudio and also want to use pulseaudio. | The pulseaudio sink automatically detects if pulseAudio is running and <u>'''so'''</u> assumes that the user, has installed pulseaudio and also want to use pulseaudio. | ||
Line 33: | Line 33: | ||
=== | === Overview of pulseaudio format support === | ||
Pulseaudio is '''limited''' to what passthought formats it supports. Below is a quick reference to illustrate this. Not a XBMC limitation! | Pulseaudio is '''limited''' to what passthought formats it supports. Below is a quick reference to illustrate this. Not a XBMC limitation! | ||
Line 65: | Line 65: | ||
|} | |} | ||
== | == Setting up pavucontrol == | ||
=== | === Passthrough === | ||
{{bluev|'''IMPORTANT:'''|Passthrough is always exclusive mode. If you have another application hogging the device, e.g. google chrome or skype or something else, Passthrough won't work.}} | {{bluev|'''IMPORTANT:'''|Passthrough is always exclusive mode. If you have another application hogging the device, e.g. google chrome or skype or something else, Passthrough won't work.}} | ||
{{greenv|'''REMEMBER:'''| To use passthrough you need to be using '''2.0''' channel configuration via '''pavucontrol''' (e.g. Digital Stereo (HDMI)}} | {{greenv|'''REMEMBER:'''| To use passthrough you need to be using '''2.0''' channel configuration via '''pavucontrol''' (e.g. Digital Stereo (HDMI)}} | ||
Line 80: | Line 80: | ||
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. | 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 === | ||
To alternatively configure Multi channel, do the following: | To alternatively configure Multi channel, do the following: | ||
Line 88: | Line 88: | ||
</gallery> | </gallery> | ||
=== | === Example setup in xbmc === | ||
{{orangev|'''GOOD TO KNOW:'''| Limit sample rate can be set to Fixed - between 48kHz ~ 192kHz or as Optimized and even Best match.}} | {{orangev|'''GOOD TO KNOW:'''| Limit sample rate can be set to Fixed - between 48kHz ~ 192kHz or as Optimized and even Best match.}} | ||
Line 102: | Line 102: | ||
{{-}} | {{-}} | ||
=== | === Guide setup in xbmc === | ||
{{orangev|DEVICE ENUMERATION:| XBMC Enumerates Pulseaudio devices as SPDIF when you have '''Passthrough''' set. Otherwise its '''PCM Device'''.}} | {{orangev|DEVICE ENUMERATION:| XBMC Enumerates Pulseaudio devices as SPDIF when you have '''Passthrough''' set. Otherwise its '''PCM Device'''.}} | ||
{{bluev|GOOD TO KNOW:|SPDIF has 2 pcm channels but can do virtual 5.1 formats like dts, ac3, eac3.}} | {{bluev|GOOD TO KNOW:|SPDIF has 2 pcm channels but can do virtual 5.1 formats like dts, ac3, eac3.}} | ||
Line 227: | Line 227: | ||
{{orangev|'''IMPORTANT:'''| You can only have '''AC3''', '''DTS''', '''EAC3''' passthrough '''if your Receiver supports it'''. Most '''TV's''' only support '''AC3'''. If you have a '''HDMI''' connection to your TV and '''from this TV''' a '''SPDIF/Optical''' connection to an '''AVR''', passthrough might not work at all.}} | {{orangev|'''IMPORTANT:'''| You can only have '''AC3''', '''DTS''', '''EAC3''' passthrough '''if your Receiver supports it'''. Most '''TV's''' only support '''AC3'''. If you have a '''HDMI''' connection to your TV and '''from this TV''' a '''SPDIF/Optical''' connection to an '''AVR''', passthrough might not work at all.}} | ||
== | == Combined Output == | ||
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 add: | 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 add: | ||
<pre>load-module module-combine-sink sink_name=combined</pre> | <pre>load-module module-combine-sink sink_name=combined</pre> | ||
to /etc/pulse/default.pa and restart pulseaudio. xbmc will then pickup the device, it is named '''combined'''. | to /etc/pulse/default.pa and restart 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. | 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. | ||
Line 247: | Line 247: | ||
{{orangev|'''Alternatively:'''| If you don't want any resampling outside xbmc, e.g. no resampling done extra by pulse, you need to configure the sink as told above and set Audio Engine to '''Fixed''' with 2 channels and samplerate of '''96 khz''' with resample quality high. In that combination xbmc will take care that files are resampled (e.g. 44.1 khz or 48 khz media) in the best possible quality. Already 96 khz files are not touched at all. }} | {{orangev|'''Alternatively:'''| If you don't want any resampling outside xbmc, e.g. no resampling done extra by pulse, you need to configure the sink as told above and set Audio Engine to '''Fixed''' with 2 channels and samplerate of '''96 khz''' with resample quality high. In that combination xbmc will take care that files are resampled (e.g. 44.1 khz or 48 khz media) in the best possible quality. Already 96 khz files are not touched at all. }} | ||
== | == FAQ == | ||
;When would I want Pulseaudio? | ;When would I want Pulseaudio? | ||
Line 273: | Line 273: | ||
- Be warned as this might interfere with your Desktop sounds and pulseaudio! | - Be warned as this might interfere with your Desktop sounds and pulseaudio! | ||
=== | === 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. | 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 === | ||
{{forum link2|[[forum:183436|Linux - Pulseaudio Sink]] Discussion and further information.}}<br /> | {{forum link2|[[forum:183436|Linux - Pulseaudio Sink]] Discussion and further information.}}<br /> | ||
[[Category:How-to]] | [[Category:How-to]] | ||
[[Category:Audio]] | [[Category:Audio]] |
Revision as of 21:37, 6 March 2014
Audio OS Config: Windows • Linux - Intel HD Audio • Linux - PulseAudio |
Outline
In the past, XBMC had immense problems with users not getting audio, because they had a full blown Ubuntu desktop environment with pulseaudio installed.
Pulseaudio blocked the specific device required, and audio playback only worked reliably when using the virtual pulse device. Our workaround for those users was to uninstall pulseaudio.
This of course broke complete desktop audio for these users.
- We wanted this situation to change with XBMC Gotham releases.
Users that run a normal Ubuntu desktop and just use xbmc for normal video & audio playback while also wanting audio in parallel in their browser or pause xbmc, run a game or rhythmbox / Skype or similar now use our new PulseAudio Sink when using XBMC Gotham builds. XBMC only uses pulseaudio because you have installed it and it is running.
Introduction
The pulseaudio sink automatically detects if pulseAudio is running and so assumes that the user, has installed pulseaudio and also want to use pulseaudio.
This pulseaudio sink is also able to do AC3, DTS and EAC3 passthrough. Alternatively it can be configured to be a 7.1 or 5.1 output device which is then a PCM multichannel - This is an exclusive Or which means that pulseaudio only provides AC3, DTS, EAC3 when it is configured to run with 2.0 channels (which is the default on every Desktop).
Overview of pulseaudio format support
Pulseaudio is limited to what passthought formats it supports. Below is a quick reference to illustrate this. Not a XBMC limitation!
Passthrough Support Audio formats Supported Limitations AC3 Yes No DTS Yes No DD+/E-AC3 Yes No DTS-HD No Yes TrueHD No Yes
Setting up pavucontrol
Passthrough
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
To alternatively configure Multi channel, do the following:
Example setup in xbmc
Guide setup in xbmc
XBMC Settings | PC Speakers (2.0) |
PC Speakers (5.1) |
TV | AVR SPDIF | AVR HDMI ★ |
AVR HDMI ★★ |
SPDIF AC3 support |
---|---|---|---|---|---|---|---|
Audio Output | Analog | Analog | Analog | Optical/Coaxial | HDMI | HDMI | SPDIF |
Channel number | 2.0 | 5.1 | 2.0 | 2.0 | 5.1 | 7.1 | 2.0 |
Boost volume level on downmix | Enabled | Enabled | Enabled | Enabled | Enabled | Enabled | Enabled |
Stereo upmix | Disabled | Disabled | Disabled | Disabled | Enabled | Enabled | Enabled |
Dolby Digital (AC3) capable receiver | N/A | N/A | N/A | Enabled | Disabled | Disabled | Enabled |
Dolby Digital Plus (E-AC3) capable receiver | N/A | N/A | N/A | Enabled | Disabled | Disabled | Enabled |
DTS capable receiver | N/A | N/A | N/A | Enabled | Disabled | Disabled | Enabled |
TrueHD capable receiver | N/A | N/A | N/A | Disabled | Disabled | Disabled | Disabled |
DTS-HD capable receiver | N/A | N/A | N/A | Disabled | Disabled | Disabled | Disabled |
Linux / OSX - Output Device Settings | |||||||
Audio output device | Speakers | Speakers | SPDIF/HDMI | SPDIF | HDMI | HDMI | SPDIF |
Passthrough output device | N/A | N/A | N/A | SPDIF | HDMI | HDMI | SPDIF |
★ Passthrough cannot be selected when Multichannel is enabled...
★★ Passthrough cannot be selected when Multichannel is enabled...
Combined Output
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 add:
load-module module-combine-sink sink_name=combined
to /etc/pulse/default.pa and restart 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
- When would I want Pulseaudio?
- You use your XBMC computer mainly as your Desktop when you don't run XBMC.
- You want other applications audio like Skype, youtube, browser mail notification in parallel with XBMC.
- You use xbmc in windowed mode as Desktop player
- You use Pulseaudio as a network sink to stream Audio to other devices in your living room.
- Passthrough is nice to have for you, but to be honest - you don't really need it.
- Whenever you plugin your Bluetooth headset, xbmc audio will continue over this new device (when Default 'PULSE' device is chosen)
- When would I want ALSA
- You use XBMC as your standalone media center.
- You are highly interested in bitperfect exclusive audio output.
- DTS-HD, TrueHD is something you use daily and is of high importance.
- You don't need other applications that would access audio in parallel.
Why can't I have both?
- Pulseaudio might hogg your Audio device and you cannot open the ALSA device exclusively, therefore we decided for one or the other.
Can I force ALSA, though I have pulseaudio installed and running and know that it will cause problems?
- Yes, you can - start xbmc from terminal with:
AE_SINK=ALSA xbmc
- Be warned as this might interfere with your Desktop sounds and pulseaudio!
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. |