# Notes On Migrating To Pipewire From Pulseaudio

## 1. Background

About a year ago I switched from using raw ALSA to pulseaudio. Linux on my laptop just cut over to using pipewire with pipewire-pulse providing a compatibility drop-in. However that drop-in does not automatically provide all my pulse customizations — see pulse readme for details. These notes document what broke and how I fix them.

## 2. Out-Of-The-Box Breakages

- No left or right TTS devices.
- Auditory Icons go back to using aplay rather than paplay with samples loaded
- X-Windows bell went away —
- Volume in emacspeak minor mode line went away
- ToDo: Implement all customizations from default.pa in native pipewire.

## 3. Cautionary Notes

- Make sure you install pipewire-alsa and pipewire-pulse – these enable compatibility.
- Do not install any pipewire conf files unless tested (how?); a broken conf file can lose all audio.

## 4. What I have Learn

- CLI tool pactl, pamixer work in pipewire, even when there is no pulseaudio daemon running, as long as you have pipewire-pulse installed.
- Use wpctl as the Pipewire way of manipulating the audio environment.
- To get `tts_left` and ttsright~ devices for Emacspeak, execute the corresponding pactl commands by hand at the shell for now, ie examine default.pa from the pulseaudio lines, then pass them to pactl.

    # A bs2b (binaural for headphones) sink:
    pactl load-module module-ladspa-sink sink_name=binaural  sink_master=@DEFAULT_SINK@ plugin=bs2b label=bs2b control=725,4.5
    # Use binaural as the default sink:
    pactl #set-default-sink  binaural
    # A tts_right and tts_left device
    # Emacspeak will use the first as the notification device.
    pactl load-module module-remap-sink sink_name=tts_right  master=binaural channels=2 master_channel_map=front-right,front-right, channel_map=front-left,front-right remix=no
    pactl load-module module-remap-sink sink_name=tts_left  master=binaural channels=2 master_channel_map=front-left,front-left, channel_map=front-left,front-right remix=no

    #hrtf example:

    pactl load-module module-ladspa-sink sink_name=upper plugin=ZamHeadX2-ladspa label=ZamHeadX2 control=45,45,2.5

*Bridge setup

Here, Bridge stands for crossing over to the world of Pipewire from the world of Pulseaudio. Landing completely on pipewire makes things a lot simpler, see next section.

1. Execute `./pa2pw.sh` after reboot to get `tts_left`,~ttsright~ and a `binaural` device.
2. Execute `./pw-hrtf.sh` to get 8 virtual HRTF devices.

## 5. Final Landing

- Install package `pipewire-alsa` and `pipewire-audio`.
- This removes pulseaudio from the system.
- The original `.asoundrc` that I used for nearly 15+ years works again!
- I suspect eventually that too will get simplified as `wireplumber` matures, but that day is not yet come.

Date: 2023-10-26 Thu 00:00

Author: T.V Raman

Created: 2023-11-24 Fri 19:46

Validate