Summary
Add first-class PulseAudio and PipeWire support as an optional audio backend, beyond the default ALSA compatibility layer that rodio uses.
Related: #131 (Meta-Epic: Cross-Platform Audio Playback)
Problem / Background
The MVP uses rodio's default ALSA backend on Linux. While PipeWire and PulseAudio provide ALSA compatibility layers that usually work, some configurations may have issues:
- Containers and WSL2 environments
- Custom PipeWire configurations that don't expose ALSA compat
- Audio routing through PulseAudio-only sinks
Users hitting these edge cases currently fall back to the external player backend, which loses fine-grained control.
Proposed Solution
1. Cargo Feature Flags
[features]
default = []
pulseaudio = ["cpal/jack"] # or appropriate cpal feature
2. Backend Auto-Detection
fn detect_linux_audio_backend() -> AudioBackendType {
// Check for PipeWire first (modern default)
if std::process::Command::new("pw-cli").arg("info").output().is_ok() {
return AudioBackendType::PipeWire;
}
// Check for PulseAudio
if std::process::Command::new("pactl").arg("info").output().is_ok() {
return AudioBackendType::PulseAudio;
}
// Fall back to ALSA
AudioBackendType::Alsa
}
3. Build Dependencies
# PulseAudio development libraries
sudo apt-get install libpulse-dev
# PipeWire development libraries (usually provides PulseAudio compat)
sudo apt-get install libpipewire-0.3-dev
Files to Modify
| File |
Change |
Cargo.toml |
Add optional pulseaudio feature with cpal backend flag |
src/audio/mod.rs |
Add backend detection logic |
scripts/install-build-deps.sh |
Add optional PulseAudio dev package |
.github/workflows/release.yml |
Test with PulseAudio in CI (optional) |
GETTING_STARTED.md |
Document PulseAudio build option |
Acceptance Criteria
Implementation Notes
- cpal's PulseAudio support may require the
jack or specific host features — check cpal docs
- PipeWire typically provides PulseAudio API compat, so PulseAudio support often covers PipeWire too
- This is a build-time choice, not runtime — feature flags control which cpal backend is compiled in
- Consider adding a
config.audio.backend field: "auto", "alsa", "pulseaudio"
Summary
Add first-class PulseAudio and PipeWire support as an optional audio backend, beyond the default ALSA compatibility layer that rodio uses.
Related: #131 (Meta-Epic: Cross-Platform Audio Playback)
Problem / Background
The MVP uses rodio's default ALSA backend on Linux. While PipeWire and PulseAudio provide ALSA compatibility layers that usually work, some configurations may have issues:
Users hitting these edge cases currently fall back to the external player backend, which loses fine-grained control.
Proposed Solution
1. Cargo Feature Flags
2. Backend Auto-Detection
3. Build Dependencies
Files to Modify
Cargo.tomlpulseaudiofeature with cpal backend flagsrc/audio/mod.rsscripts/install-build-deps.sh.github/workflows/release.ymlGETTING_STARTED.mdAcceptance Criteria
cargo build --features pulseaudiobuilds with PulseAudio supportImplementation Notes
jackor specific host features — check cpal docsconfig.audio.backendfield: "auto", "alsa", "pulseaudio"