HON95 3 年之前
父節點
當前提交
8ddb75e9c4
共有 3 個文件被更改,包括 146 次插入4 次删除
  1. 122 0
      config/pc/applications.md
  2. 21 1
      config/pc/arch-i3.md
  3. 3 3
      config/pc/kubuntu.md

+ 122 - 0
config/pc/applications.md

@@ -118,6 +118,128 @@ GUI for configuring gaming mice.
 1. Install `piper`.
 1. Configure the mouse using the GUI application.
 
+## PipeWire (Linux)
+
+A modern audio server replacement for PulseAudio, JACK and ALSA.
+Comes with adapters for compatibility with existing applications and such that existing tools can be used.
+
+### Resources
+
+- [[Pipewire Wiki] Config PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire)
+- [[Pipewire Wiki] Virtual devices](https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices)
+
+### Usage
+
+- Open audio control panel:
+    - GUI: `pavucontrol`
+    - TUI: `alsamixer -c <card-id>`
+- Show stuff:
+    - Show audio server info: `pactl info`
+    - Show cards: `pactl list cards`
+    - Show inputs: `pactl list sources`
+    - Show outputs: `pactl list sinks`
+    - Show sound card info: `cat /proc/asound/UMC1820/stream0` (for card UMC1820)
+
+### Installation
+
+See the [Arch (i3)](../arch-i3/) or [Kubuntu](../kubuntu/) config notes.
+
+### Configuration
+
+#### General
+
+1. Set the sample rate:
+    1. Find the card's current rate and supported rates: `cat /proc/asound/UMC1820/stream0` (for card UMC1820)
+    1. Create `/etc/pipewire/pipewire.conf.d/10-clock-rate.conf` containing the snippet below, with your chosen sample rate.
+1. Set sample depth:
+    1. **TODO**
+1. **TODO** Fix stuttering. When using loopback module only? Weird playback of old buffer for a split second when opening new audio application?
+1. Restart PipeWire to apply changes: `systemctl --user restart pipewire.service`
+
+Example contents of `/etc/pipewire/pipewire.conf.d/10-clock-rate.conf`:
+
+```
+context.properties = {
+   default.clock.rate = 96000
+}
+```
+
+#### Disable ALSA Card Profiles (ACP) for a Card
+
+Disabling ACP for an ALSA card means that all of its inputs and outputs will be provided as raw channels without surround mixing etc.
+The same result (seemingly) may also be achieved by setting the card profile to "pro audio" in e.g. pavucontrol,
+although the pro audio profile seems to mess up my sink/source routing.
+
+1. In `/etc/pipewire/media-session.d/alsa-monitor.conf`, add the snippet below in the `rules` list.
+    - `device.vendor.id` should be set to the vendor ID of the USB device. Use `lsusb` to find it. Behringer typically uses `1397`.
+1. Restart PipeWire: `systemctl --user restart pipewire.service`
+
+Snippet for `/etc/pipewire/media-session.d/alsa-monitor.conf`:
+
+```
+# Add into the existing section below
+# rules = [
+    # ...
+    {
+        matches= [
+            {
+                # Behringer
+                device.name = "~alsa_card.*"
+                device.vendor.id = "1397"
+            }
+        ]
+        actions = {
+            update-props = {
+                api.alsa.use-acp = false
+            }
+        }
+    }
+# ]
+```
+
+#### Setup Virtual Sinks and Sources Using Channels from a Multi-Channel Card
+
+Split e.g. an 8-channel output device into four stereo devices.
+Requires PipeWire v3.27 or newer.
+
+1. (Note) See [Virtual Devices (PipeWire Wiki)](https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Virtual-Devices).
+1. Disable ACP for the card (see above). (Or change to the "pro audio" profile, but that didn't work for me.)
+1. In `/etc/pipewire/media-session.d/media-session.conf`, add the snippet below in the `context.modules` list.
+    - Add a module instance for each virtual input/output device.
+    - Find the target device using `pactl list sinks` or `pactl list sources`.
+1. Restart PipeWire: `systemctl --user restart pipewire.service`
+
+Snippets for `/etc/pipewire/media-session.d/media-session.conf`:
+
+```
+# Add into the existing section below
+# context.modules = [
+    # ...
+
+    # Virtual output example
+    {   name = libpipewire-module-loopback
+        args = {
+            node.name = "BEHRINGER_UMC1820_0102"
+            node.description = "Behringer UMC1820 (1-2)"
+            capture.props = {
+                media.class = "Audio/Sink"
+                audio.position = [ FL FR ]
+            }
+            playback.props = {
+                audio.position = [ AUX0 AUX1 ]
+                node.target = "alsa_output.usb-BEHRINGER_UMC1820_B572BD9B-00.pro-output-0"
+                stream.dont-remix = true
+                node.passive = true
+            }
+        }
+    }
+
+    # Virtual input example
+    # TODO
+
+#]
+```
+
 ## PuTTY (Windows)
 
 - In `Terminal > Features`, activate `Disable application keypad mode`.

+ 21 - 1
config/pc/arch-i3.md

@@ -373,6 +373,7 @@ Note: Install _either_ the LightDM (X11 GUI) or Ly (TTY TUI) display manager, no
 ### Setup Audio
 
 Note: We're using the PipeWire sound server, a modern, security-focused and compatible replacement for both PulseAudio and JACK.
+See [PipeWire (Applications)](../applications/#pipewire) for more config info.
 
 1. Install ALSA stuff:
     1. (Note) ALSA itself is already provided as built-in kernel modules and ALSA drivers will just work.
@@ -384,10 +385,29 @@ Note: We're using the PipeWire sound server, a modern, security-focused and comp
     1. Run `pavucontrol` to configure volumes, inputs, outputs and stuff.
 1. Test it:
     1. Try playing something from the browser or whatever. It should work.
-1. (Optional) Install useful audio applications:
+1. Install useful audio applications:
     1. Install the Helvum patchbay to patch nodes and endpoints (inputs and outputs for all audio devices): `sudo pacman -S helvum`
     1. See the [PipeWire page (Arch Wiki)](https://wiki.archlinux.org/title/PipeWire).
 
+### Setup General Applications
+
+1. Setup terminal emulator:
+    1. Already done.
+1. Setup ZSH:
+    1. See [Applications: ZSH](../applications/#zsh-linux) (includes font, theme and plugins).
+1. Setup the VLC video and audio player:
+    1. `sudo pacman -S vlc`
+1. Setup the Mirage image viewer:
+    1. `yay -S mirage`
+1. Setup the Thunar graphical file manager:
+    1. `sudo pacman -S thunar`
+1. Setup the Ranger terminal file explorer:
+    1. `sudo pacman -S ranger`
+1. Setup the VS Code text editor/IDE:
+    1. `sudo pacman -S code`
+1. Setup the LibreOffice office document suite:
+    1. `sudo pacman -S libreoffice-fresh`
+
 ### Setup Bluetooth
 
 1. (Note) Make sure `rfkill` or some hardware switch isn't disabling/blocking the adapter.

+ 3 - 3
config/pc/kubuntu.md

@@ -52,11 +52,11 @@ breadcrumbs:
 
 ### PipeWire
 
-Kubuntu comes with PulseAudio. PipeWire is a modern solution designed to replace PulseAudio, JACK and ALSA. This means it combines the simplicity of basic desktop usage from PulseAudio with the complexity of session managers from JACK, with extra focus on security, performance and compatibility. Plus it supports video.
+Kubuntu comes with PulseAudio. PipeWire is a modern solution designed to replace PulseAudio, JACK and ALSA. This means it combines the simplicity of basic desktop usage from PulseAudio with the complexity of session managers from JACK, with extra focus on security, performance and compatibility. Plus it supports video. See [PipeWire (Applications)](../applications/#pipewire) for more config info.
 
 1. Install PipeWire:
-    1. Install: `sudo apt install pipewire pipewire-audio-client-libraries`
-    1. Enable: `systemctl --user enable --now pipewire-pulse`
+    1. Install: `sudo apt install pipewire pipewire-audio-client-libraries pipewire-pulse`
+    1. **TODO** Required to enable pipewire or pipewire-pulse?
 1. Disable PulseAudio:
     1. (Note) The package is required by Kubuntu, so it can't be completely removed.
     1. Disable PulseAudio: `systemctl --user disable --now pulseaudio.service pulseaudio.socket`