Próximo: , Anterior: , Acima: Home Services   [Conteúdo][Índice]


13.3.11 Sound Home Services

The (gnu home services sound) module provides services related to sound support.

PulseAudio RTP Streaming Services

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 or pulsemixer (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:

(service home-pulseaudio-rtp-sink-service-type
         "192.168.1.42")

On the device where you intend to receive and play the RTP stream, you can use home-pulseaudio-rtp-source-service-type, like so:

(service home-pulseaudio-rtp-source-service-type)

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:

(service home-pulseaudio-rtp-source-service-type
         "0.0.0.0")

The reference of these services is given below.

Variável: home-pulseaudio-rtp-sink-service-type
Variável: home-pulseaudio-rtp-source-service-type

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, respectively pulseaudio-rtp-source. 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.

Variável: %pulseaudio-rtp-multicast-address

This is the multicast address used by default by the two services above.

PipeWire Home Service

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 WirePlumber session manager, a reference implementation provided by the PipeWire project itself, suffices, and that is the one home-pipewire-service-type uses.

PipeWire can be used as a replacement for PulseAudio by setting enable-pulseaudio? to #t in home-pipewire-configuration, so that existing PulseAudio clients may use it without any further configuration.

In addition, JACK clients may connect to PipeWire by using the pw-jack program, which comes with PipeWire. Simply prefix the command with pw-jack when you run it, and audio data should go through PipeWire:

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, wireplumber, and, if configured, pipewire-pulseaudio services. Veja Managing User Daemons.

Variável: home-pipewire-service-type

This provides the service definition for pipewire, which will run on login. Its value is a home-pipewire-configuration object.

To start the service, add it to the service field of your home-environment, such as:

(service home-pipewire-service-type)
Data Type: home-pipewire-configuration

Available home-pipewire-configuration fields are:

pipewire (default: pipewire) (type: file-like)

The PipeWire package to use.

wireplumber (default: wireplumber) (type: file-like)

The WirePlumber package to use.

enable-pulseaudio? (default: #t) (type: boolean)

When true, enable PipeWire’s PulseAudio emulation support, allowing PulseAudio clients to use PipeWire transparently.


Próximo: Mail Home Services, Anterior: Fonts Home Services, Acima: Home Services   [Conteúdo][Índice]