Short maybe-up-to-date (as of August 2022) HOWTO to get Pipewire work as PA/ALSA replacement on Debian Testing/Bookworm (and probably unstable as well). This is just list of notes for how I did it, on a system that has avoided using PulseAudio garbage and only had plain ALSA with DMIX configured previously.
Install Pipewire, the PA/ALSA compat stuff and WirePlumber
sudo apt install pipewire pipewire-pulse pipewire-jack pipewire-alsa wireplumber dbus-user-session rtkit
NOTE: I am not entirely sure if dbus-user-session is needed or not. During my first attempts, it seemed to matter for getting Pipewire and Wireplumber started properly for Xorg session, despite that package descriptions say that 'dbus-x11' should be enough. Having it installed should do no harm in any case.
Then, reload the systemd configuration.
systemctl --user daemon-reload
Edit /etc/asound.conf if necessary, in my case I removed everything else but the default audio device configuration, leaving out dmix etc since those things are not needed now. My configuration now looks as follows:
pcm.!default { type hw card PCH device 0 subdevice 0 } ctl.!default { type hw card PCH }
Having an asound.conf may or may not be necessary for you. In my case ALSA defaults to using wrong output and mixer devices (HDMI audio), so I need to configure it. You could leave it unconfigured (e.g. no config file) and use 'pactl' (or edit $HOME/.local/state/wireplumber/default-profile) to set the default sink on Pipewire level.
Depending on your use-cases, you may wish to increase the realtime priority of pipewire as the default may be a bit low. In order to do that, you need to create an override service file:
mkdir /etc/systemd/system/rtkit-daemon.service.d/ cat << EOF > /etc/systemd/system/rtkit-daemon.service.d/override.conf [Service] ExecStart= ExecStart=/usr/libexec/rtkit-daemon --our-realtime-priority=49 --max-realtime-priority=48 EOF
This increases the max priority from to 48. Some people use even higher values, like the source for this information found in a comment of Pipewire Gitlab ticket #685. However, another commenter warns against using values that big. YMMV.
NB: The configuration change in /etc/pipewire/ mentioned in ticket #685 is not needed for newer versions of Pipewire, the default rt.* values have been increased to 88 so it is only limited by what kernel/rtkit allows.
If you had PulseAudio daemon etc installed, you probably want to get rid of it now. Since I've never had it, I can't really help with that. You probably want to uninstall all packages with a name that begins with "pulseaudio".
You'll have to leave some of the libraries around due to dependencies: libpulse-mainloop-glib0 libpulse0 and you might want to leave / install pulseaudio-utils for 'pactl'.
At this point you may wish to restart your X session, or maybe even reboot. Session restart should be enough, though. If you had PulseAudio installed, you may need to kill the pulseaudio processes first.
Everything should be ready and work now. Attempt to use some software that outputs audio. You can use 'pw-top', a simple terminal program, to monitor the sources and sinks in real time. pw-top should show a list similar to following:
! 28 0 0 0.0µs 0.0µs 0.00 0.00 0 Dummy-Driver ! 29 0 0 0.0µs 0.0µs 0.00 0.00 0 Freewheel-Driver ! 35 0 0 0.0µs 0.0µs 0.00 0.00 0 Midi-Bridge 39 2048 48000 41.1µs 46.3µs 0.00 0.00 7 alsa_output.pci-0000_00_1b.0.analog-stereo 71 3600 48000 10.8µs 21.1µs 0.00 0.00 7 + Firefox
E.g. there should be at least one output sink (alsa_output.pci-0000_00_1b.0.analog-stereo in my case) and few *-Driver and if any sound-using software is running, those should be listed as clients.
You can try 'pw-play <file>' to play some WAV/FLAC or so file to make sure that Pipewire itself works directly.
I previously used 'apulse' PulseAudio emulation over ALSA wrapper with Firefox. If you did also, you should remember to remove it to avoid useless indirection.
One issue I ran into while trying things is that at some point WirePlumber decided to set the "default sink" to incorrect ALSA device. I am not sure how that happened, but it felt difficult to find out where it got/stored the setting .. trying to fix it with 'pactl set-default-sink' was not possible because Pipewire was not seeing any other sinks.
Eventually I found that $HOME/.local/state/wireplumber/default-profile contains the device profile. You can try deleting that file and restarting wireplumber.
If you get trouble with Wireplumber not starting properly, e.g. something like:
wireplumber: Error acquiring session bus address: Cannot autolaunch D-Bus without X11 $DISPLAY
in user journal, you may have to restart session (log out/login) several times. Or reboot completely.