home-assistant.io/source/_components/pulseaudio_loopback.markdown
Franck Nijhof c464056402
Making our website faster, cleaner and prettier (#9853)
* 🔥 Removes octopress.js

* 🔥 Removes use of root_url var

* 🔥 Removes Octopress generator reference from feed

* 🔥 Removes delicious support

* 🔥 Removes support for Pinboard

* 🔥 Removes support for Disqus

* 🔥 Removes support for Google Plus

* ↩️ Migrate custom after_footer to default template

* ↩️ Migrate custom footer to default template

* ↩️ Migrate custom header to default template

* 🔥 Removes unused template files

* 🚀 Places time to read directly in post template

* 🚀 Removes unneeded capture from archive_post.html template

* 🔥 🚀 Removes unused, but heaving sorting call in component page

* 🚀 Merged javascripts into a single file

* 🔥 Removes more uses of root_url

* 🚀 Removal of unneeded captures from head

* 🔥 🚀 Removal of expensive liquid HTML compressor

* 🔥 Removes unneeded templates

* 🚀 Replaces kramdown with GitHub's CommonMark 🚀

* 💄 Adds Prism code syntax highlighting

*  Adds support for redirect in Netlify

* ↩️ 🔥 Let Netlify handle all developer doc redirects

* ✏️ Fixes typo in redirects file: Netify -> Netlify

* 🔥 Removes unused .themes folder

* 🔥 Removes unused aside.html template

* 🔥 Removes Disqus config leftover

* 🔥 Removes rouge highlighter config

* 🔥 Removes Octopress 🎉

* 💄 Adjust code block font size and adds soft wraps

* 💄 Adds styling for inline code blocks

* 💄 Improve styling of note/warning/info boxes + div support

* 🔨 Rewrites all note/warning/info boxes
2019-07-15 22:17:54 +02:00

70 lines
2.4 KiB
Markdown

---
title: "PulseAudio Loopback Switch"
description: "Instructions on how to use Pulseaudio loopback modules to build a flexible whole-home audio system."
logo: pulseaudio.png
ha_category:
- Switch
ha_release: 0.16
ha_iot_class: Local Polling
redirect_from:
- /components/switch.pulseaudio_loopback/
---
The goal behind this switch is to allow a very flexible whole home audio system based upon [PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio/).
For example, for a system with a 7.1 surround sound card, and 3 instances of [MPD](https://www.musicpd.org/) running, it is possible to quickly route the output of any MPD instance to any of the 8 possible (4 stereo) channels on the sound card, by loading/unloading a loopback module. This loading/unloading functionality is provided by this component. When the switch is `on`, the loopback module is loaded. When the switch is `off`, the module is not loaded.
The benefit of this approach is that this audio routing can occur without modifying the design-time configuration of MPD or PulseAudio.
This integration uses a TCP connection to control a local or remote PulseAudio server. So there are no local dependencies.
To enable this switch, add the following lines to your `configuration.yaml` file:
```yaml
# Example configuration.yaml entry
switch:
- platform: pulseaudio_loopback
```
{% configuration %}
sink_name:
description: The name of the Pulseaudio sink that will receive the audio.
required: true
type: string
source_name:
description: The name of the Pulseaudio source that will supply the audio.
required: true
type: string
name:
description: Name of the switch.
required: false
default: paloopback
type: string
host:
description: The IP address or host name of the PulseAudio server.
required: false
default: localhost
type: string
port:
description: The port that Pulseaudio is listening on.
required: false
default: 4712
type: integer
buffer_size:
description: How much data to load from Pulseaudio at once.
required: false
default: 1024
type: integer
tcp_timeout:
description: How long to wait for a response from Pulseaudio before giving up.
required: false
default: 3
type: integer
{% endconfiguration %}
<div class='note warning'>
This integration relies on raw TCP commands to PulseAudio. In order for PulseAudio to accept commands with this component, `module-cli-protocol` must be loaded on the PulseAudio server.
</div>