ALSA + dmix + apulse Reproduction Notes

This documents a working configuration that lets multiple applications share the sound card via ALSA's dmix plugin, with apulse redirecting PulseAudio-only apps to that same mixed device. No PulseAudio or PipeWire daemon is involved.

1. Required packages (Debian/Ubuntu)

apt install alsa-utils apulse

Versions in use here: alsa-utils 1.2.14-1, apulse 0.1.13-2+b3.

2. ALSA config — ~/.asoundrc

Sets the default PCM to a plug wrapper around a dmix slave bound to hw:0,0. plug handles rate/format conversion so apps that don't natively match 48 kHz / S16_LE still work.

pcm.!default {
    type plug
    slave.pcm "dmixer"
}

pcm.dmixer {
    type dmix
    ipc_key 1024
    ipc_perm 0666
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 48000
        channels 2
        format S16_LE
    }
    bindings {
        0 0
        1 1
    }
}

ctl.!default {
    type hw
    card 0
}
Notes:

3. apulse global env var — /etc/zsh/zshrc

Added to the system-wide zshrc so every zsh user inherits it. This tells apulse to send output through the dmix-backed default rather than straight to hw:0,0 (which would block other apps).

export APULSE_PLAYBACK_DEVICE=plug:dmixer

Currently sits at /etc/zsh/zshrc:65.

For bash users, add the same line to /etc/bash.bashrc (or /etc/profile.d/apulse.sh for a shell-agnostic drop-in).

4. Usage

# Native ALSA app — uses dmix automatically via the default PCM
aplay sound.wav

# PulseAudio-only app — wrap with apulse
apulse firefox
apulse some-electron-app

5. Verification

# Confirm card index
aplay -l

# Test the dmix path directly
aplay -D plug:dmixer /usr/share/sounds/alsa/Front_Center.wav

# Confirm env var is exported in a fresh shell
echo $APULSE_PLAYBACK_DEVICE   # → plug:dmixer

6. Reproduction checklist

  1. Install alsa-utils and apulse.
  2. Write the asoundrc block above to ~/.asoundrc (or /etc/asound.conf system-wide).
  3. Append export APULSE_PLAYBACK_DEVICE=plug:dmixer to /etc/zsh/zshrc (and/or /etc/bash.bashrc).
  4. Open a new shell; verify with the commands in §5.
  5. Make sure no PulseAudio/PipeWire daemon is running and grabbing the card.