The (gnu home services sound)
module provides services related to
The following services dynamically reconfigure the
PulseAudio sound server: they let you toggle
broadcast of audio output over the network using the RTP (real-time
transport protocol) and, correspondingly, playback of sound received over
RTP. Once home-pulseaudio-rtp-sink-service-type
is among your home
services, you can start broadcasting audio output by running this command:
herd start pulseaudio-rtp-sink
You can then run a PulseAudio-capable mixer, such as pavucontrol
(both from the same-named package) to control which audio
stream(s) should be sent to the RTP “sink”.
By default, audio is broadcasted to a multicast address: any device on the LAN (local area network) receives it and may play it. Using multicast in this way puts a lot of pressure on the network and degrades its performance, so you may instead prefer sending to specifically one device. The first way to do that is by specifying the IP address of the target device when starting the service:
herd start pulseaudio-rtp-sink 192.168.1.42
The other option is to specify this IP address as the one to use by default in your home environment configuration:
On the device where you intend to receive and play the RTP stream, you can
, like so:
This will then let you start the receiving module for PulseAudio:
herd start pulseaudio-rtp-source
Again, by default it will listen on the multicast address. If, instead, you’d like it to listen for direct incoming connections, you can do that by running:
The reference of these services is given below.
This is the type of the service to send, respectively receive, audio streams over RTP (real-time transport protocol).
The value associated with this service is the IP address (a string) where
to send, respectively receive, the audio stream. By default, audio is
sent/received on multicast address %pulseaudio-rtp-multicast-address
This service defines one Shepherd service: pulseaudio-rtp-sink
. The service is not started by
default, so you have to explicitly start it when you want to turn it on, as
in this example:
herd start pulseaudio-rtp-sink
Stopping the Shepherd service turns off broadcasting.
This is the multicast address used by default by the two services above.
PipeWire provides a low-latency, graph-based audio and video processing service. In addition to its native protocol, it can also be used as a replacement for both JACK and PulseAudio.
While PipeWire provides the media processing and API, it does not, directly,
know about devices such as sound cards, nor how you might want to connect
applications, hardware, and media processing filters. Instead, PipeWire
relies on a session manager to specify all these relationships. While
you may use any session manager you wish, for most people the
session manager, a reference implementation provided by the PipeWire project
itself, suffices, and that is the one home-pipewire-service-type
PipeWire can be used as a replacement for PulseAudio by setting
, so that existing PulseAudio clients may
use it without any further configuration.
In addition, JACK clients may connect to PipeWire by using the
program, which comes with PipeWire. Simply prefix the
command with pw-jack
when you run it, and audio data should go
pw-jack mpv -ao=jack sound-file.wav
For more information on PulseAudio emulation, see https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PulseAudio, for JACK, see https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-JACK.
As PipeWire does not use dbus
to start its services on demand (as
PulseAudio does), home-pipewire-service-type
uses Shepherd to start
services when logged in, provisioning the pipewire
, and, if configured, pipewire-pulseaudio
services. Voir Gérer les démons personnels.
This provides the service definition for pipewire
, which will run
on login. Its value is a home-pipewire-configuration
To start the service, add it to the service
field of your
, such as:
) (type: file-like)The PipeWire package to use.
) (type: file-like)The WirePlumber package to use.
) (type: boolean)When true, enable PipeWire’s PulseAudio emulation support, allowing PulseAudio clients to use PipeWire transparently.