diff --git a/wiki/linux/pipewire.md b/wiki/linux/pipewire.md index 2a44393..8723cb3 100644 --- a/wiki/linux/pipewire.md +++ b/wiki/linux/pipewire.md @@ -15,11 +15,12 @@ Make sure to restart to be sure everything is running correctly. ## Usage -For simple sound processing in the form of volume adjustment as well as setting -the default input and output devices +This section will focus on the usage of Pipewire. -### Volume Control +### Mixing +For simple sound processing in the form of volume adjustment as well as setting +the default input and output devices [`pavucontrol`](https://freedesktop.org/software/pulseaudio/pavucontrol/) can be used as a simple mixer. @@ -72,14 +73,25 @@ pw-loopback -C ### Virtual Devices -The source for this section of the entry is derived by -[Pipewire Gitlab site](https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices#behringer-umc404hd-speakersheadphones-virtual-sinks). +This section focusses on the temporary and permanent creation and removal of virtual devices like +virtual sinks and sources aswell as coupled nodes like loopbacks. #### Creating a Null Device +This section will focus on the creation of a dummy device. +That is a virtual device that can be selected as output but is not used by default. +This can be useful to record applications as their sound can cleanly be passed to the dummy device +which will eliminate other applications sounds. +If the goal is to record and listen to an application at the same time navigate to +[the application loopback section](#creating-an-application-loopback) + +The source for this section of the entry is derived by +[Pipewire Gitlab site](https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices#single-nodes). + A dummy device, or null sink, can be created permanently by creating a `.conf` file inside the `~/.config/pipewire/pipewire.conf.d` directory with the following lines. + ```txt context.objects = [ { factory = adapter @@ -116,3 +128,94 @@ This will return an id that can be used to remove the sink with the following co ```sh pactl unload-module ``` + +#### Creating a Device Loopback + +In this section a device loopback is defined as a loopback that takes a device as input. +This can be useful to listen to input devices, such as audio interfaces with connected microphones, +instruments, etc. + +The source for this section of the entry is derived by +[Pipewire Gitlab site](https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices#single-nodes) +and [the official website](https://docs.pipewire.org/page_module_loopback.html). + +A device loopback can be created permanently by creating a `.conf` file inside the +`~/.config/pipewire/pipewire.conf.d` directory with the following lines. + +```txt +context.modules = [ + { + name = libpipewire-module-loopback + args = { + audio.position = [ FL FR ] + capture.props = { + media.class = "Stream/Input/Audio" + node.name = "device-loopback-1-recording" + node.description = "Device-Loopback 1 Recording" + } + playback.props = { + media.class = "Stream/Output/Audio" + node.name = "device-loopback-1-playback" + node.description = "Device-Loopback 1 Playback" + } + audio.volume = 0.5 + audio.mute = true + } + } +] +``` + +The created device loopback is made up by two parts that can be found in different places inside a +mixer like [pavucontrol](#volume-control). +The part called `Device-Loopback 1 Recording` in the example config can be found in the `Recording` +tab. +There the device to loopback can be selected. +The second part called `Device-Loopback 1 Playback` is available under the `Playback` tab and +allows to switch the selection of the output device. + +#### Creating an Application Loopback + +This section will focus on the creation of an application loopback. +In this section an application loopback is defined as a loopback that takes an application as input. +This can be useful to record applications as their sound can cleanly be passed to the sink sink of +the applicatino loopback which will eliminate other applications sounds. +If the goal is to record and not listen to the application at the same time navigate to +[the null device section](#creating-a-null-device). +Alternatively the null device can also be selected as a output device for the playback part of the +application loopback which makes it easily and seemlessly possible to switch between listening in +and not listening without changing the device that is recorded by the capturing program. + +The source for this section of the entry is derived by +[Pipewire Gitlab site](https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices#single-nodes) +and [the official website](https://docs.pipewire.org/page_module_loopback.html). + +An application loopback can be created permanently by creating a `.conf` file inside the +`~/.config/pipewire/pipewire.conf.d` directory with the following lines. + +```txt +context.modules = [{ + name = libpipewire-module-loopback + args = { + audio.position = [ FL FR ] + capture.props = { + media.class = "Audio/Sink" + node.name = "application-loopback-1-sink" + node.description = "Application-Loopback 1 Sink" + } + playback.props = { + media.class = "Stream/Output/Audio" + node.name = "application-loopback-1-playback" + node.description = "Application-Loopback 1 Playback" + } + } +}] +``` + +The created device loopback is made up by two parts that can be found in different places inside a +mixer like [pavucontrol](#volume-control). +The part called `Application-Loopback 1 Sink` in the example config can be found in the `Output +Devices` tab. +The second part called `Application-Loopback 1 Playback` is available under the `Playback` tab and +allows to switch the selection of the output device. +Also in the `Playback` tab `Application-Loopback 1 Sink` can be selected as an output for currently +running applications which will loopback the sound to the selected output device. diff --git a/wiki/linux/pulseaudio.md b/wiki/linux/pulseaudio.md index 2447a50..7544b62 100644 --- a/wiki/linux/pulseaudio.md +++ b/wiki/linux/pulseaudio.md @@ -6,8 +6,10 @@ ## Usage +This section will discuss the usage of PulseAudio. + ### Mixing For simple sound processing in the form of volume adjustment as well as setting -the default input and output devices `pavucontrol` can be used as a simple -mixer. +the default input and output devices [`pavucontrol`](/wiki/linux/pipewire.md#mixing) can be +used as a simple mixer.