home-lab/modules/sound
2025-06-19 21:15:24 +02:00
..
audio-desktop-integration.nix Add comprehensive PipeWire audio configuration with noise suppression 2025-06-18 20:57:39 +02:00
disable-auto-rnnoise.nix some work on sound anf noise suppression and research into netdata 2025-06-19 21:15:24 +02:00
easyeffects-presets.nix Add comprehensive PipeWire audio configuration with noise suppression 2025-06-18 20:57:39 +02:00
pipewire.nix some work on sound anf noise suppression and research into netdata 2025-06-19 21:15:24 +02:00
README.md Add comprehensive PipeWire audio configuration with noise suppression 2025-06-18 20:57:39 +02:00
troubleshoot-voice-distortion.sh fix: prevent troubleshoot script from exiting abruptly 2025-06-18 21:53:55 +02:00
validate-audio.sh Add comprehensive PipeWire audio configuration with noise suppression 2025-06-18 20:57:39 +02:00

PipeWire with WirePlumber Configuration

This module provides a comprehensive PipeWire setup with WirePlumber session management, noise suppression, and GUI tools for audio management.

Features

Core Audio Stack

  • PipeWire: Modern audio server with low latency
  • WirePlumber: Session manager for device management and routing
  • ALSA/PulseAudio/JACK Compatibility: Works with all major audio APIs
  • Real-time Processing: RTKit integration for optimal performance

Noise Suppression

  • RNNoise Plugin: AI-powered noise suppression for microphones
  • EasyEffects Integration: GUI for managing audio effects
  • Automatic Filter Chain: Pre-configured noise suppression pipeline

GUI Applications Included

  • EasyEffects: Modern audio effects processor with noise suppression
  • PulseAudio Volume Control (pavucontrol): Volume and device management
  • Helvum: Graphical PipeWire patchbay for routing
  • qpwgraph: Qt-based PipeWire graph manager
  • pwvucontrol: Native PipeWire volume control

Quick Start

1. Import the Module

Add to your NixOS configuration:

imports = [
  ./modules/sound/pipewire.nix
];

2. Rebuild System

sudo nixos-rebuild switch

3. Verify Installation

# Check if PipeWire is running
systemctl --user status pipewire

# Launch the audio setup helper
audio-setup

# Test microphone with noise suppression
microphone-test

Using Noise Suppression

  1. Launch EasyEffects: easyeffects or use the application menu
  2. Go to the "Input" tab
  3. Load the pre-configured "Microphone_Noise_Suppression" preset
  4. Enable the RNNoise effect
  5. Adjust the "VAD Threshold" (Voice Activity Detection) as needed

Method 2: PipeWire Filter Chain (Automatic)

The configuration includes an automatic RNNoise filter chain that creates a "Noise Canceling Source" device. This appears as a separate microphone input in audio applications.

GUI Applications Usage

EasyEffects

  • Purpose: Real-time audio effects and noise suppression
  • Launch: easyeffects or from application menu
  • Features: RNNoise, equalizer, compressor, limiter, gate
  • Auto-start: Configured to start with desktop session

Volume Controls

  • pavucontrol: Traditional PulseAudio-style interface
  • pwvucontrol: Native PipeWire interface
  • Usage: Control volumes, switch devices, manage streams

Audio Routing

  • Helvum: Visual patchbay for connecting audio streams
  • qpwgraph: Advanced graph-based routing interface
  • Usage: Route audio between applications and devices

Command-Line Tools

System Status

# PipeWire status overview
wpctl status

# Real-time monitoring
pw-top

# Inspect audio objects
pw-dump | jq '.'

# Show metadata
pw-metadata

Device Management

# List devices
wpctl status

# Set default sink
wpctl set-default SINK_ID

# Set volume
wpctl set-volume SOURCE_ID 80%

# Mute/unmute
wpctl set-mute SOURCE_ID toggle

Testing

# Test microphone
microphone-test

# Record and playback test
arecord -d 5 -f cd test.wav && aplay test.wav

Configuration Details

Audio Quality Settings

  • Sample Rate: 48kHz (professional audio standard)
  • Buffer Size: 1024 samples (balanced latency/stability)
  • Resampling Quality: High (level 4)
  • Channels: Stereo support with spatial audio capabilities

Noise Suppression Settings

  • RNNoise VAD Threshold: 50% (adjustable)
  • VAD Grace Period: 200ms
  • Noise Reduction: 80% wet signal
  • Processing: Real-time with minimal latency

Performance Optimizations

  • Real-time Scheduling: RTKit enabled
  • Memory Locking: Enabled for critical processes
  • CPU Affinity: Configurable per audio thread
  • Quantum Settings: Optimized for low latency

Troubleshooting

Common Issues

No Audio Output

# Check PipeWire is running
systemctl --user restart pipewire pipewire-pulse wireplumber

# Check default devices
wpctl status

Microphone Not Working

# Test microphone detection
arecord -l

# Check permissions
groups $USER | grep audio

High CPU Usage

# Monitor PipeWire performance
pw-top

# Check buffer settings
pw-metadata | grep quantum

Noise Suppression Not Working

  1. Verify RNNoise plugin is loaded: ladspa-ls | grep -i noise
  2. Check EasyEffects preset is loaded
  3. Ensure correct input device is selected
  4. Adjust VAD threshold in EasyEffects

Reset Configuration

# Reset user PipeWire configuration
rm -rf ~/.config/pipewire ~/.config/easyeffects
systemctl --user restart pipewire pipewire-pulse wireplumber

Advanced Configuration

Custom Filter Chains

Edit /etc/pipewire/pipewire.conf.d/10-noise-suppression.conf to modify the RNNoise filter chain parameters.

Device-Specific Settings

Add rules to /etc/wireplumber/wireplumber.conf.d/51-noise-suppression.conf for specific audio devices.

EasyEffects Presets

Custom presets are stored in /etc/easyeffects/ and can be modified or extended.

Integration with Applications

Discord/Zoom/Teams

  1. Set default microphone to "Noise Canceling Source" in application settings
  2. Or use EasyEffects on the regular microphone input
  3. Adjust noise gate and compressor settings as needed

OBS Studio

  1. Add "Application Audio Capture" source
  2. Select the noise-suppressed microphone device
  3. Or use OBS's built-in noise suppression with the processed audio

Music Production (JACK)

# Start JACK mode if needed
pw-jack your-daw-application

Updates and Maintenance

Updating Configuration

After modifying the Nix configuration:

sudo nixos-rebuild switch
systemctl --user restart pipewire pipewire-pulse wireplumber

Monitoring Performance

Regular checks recommended:

# Weekly performance check
pw-top

# Monthly configuration review
audio-setup

See Also