⚙️ OS Configuration - Real-Time Audio Optimization¶
Critical: Modern OS audio enhancements destroy the precise timing required for audio plugin development. This guide disables all interfering features.
Goal: Achieve deterministic audio processing with minimal latency jitter.
🪟 Windows 10/11 Optimizations¶
Windows audio subsystem has layers of "enhancements" that introduce latency, jitter, and unpredictable behavior. Every enhancement must be disabled.
1️⃣ Audio Exclusivity & Enhancements¶
Why? Windows audio enhancements (EQ, reverb, loudness) add 10-30ms latency and process audio in the background, interfering with your plugin's processing.
Step-by-Step Configuration¶
Navigate to Sound Settings:
Or use Run dialog (Win+R):
For Each Audio Device (Speakers, Headphones, Line Out):
- Right-click device →
Properties - Navigate to
Advancedtab - Enable these options:
-
Set Default Format:
⚠️ Do NOT use 44100 Hz - Most interfaces default to 48kHz, mismatches cause resampling latency. -
Navigate to
Enhancementstab -
Critical: Check this box:
Or individually disable: -
Click
Apply→OK
Verification¶
# Check if exclusive mode is enabled (PowerShell)
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\*" | Select-Object -Property *Exclusive*
Expected: Both AllowExclusive and PriorityExclusive should be 1.
2️⃣ Power Settings (Critical for Real-Time)¶
Why? CPU throttling and USB power saving introduce latency spikes (5-50ms) that cause audio dropouts.
Power Plan Configuration¶
Option A: High Performance Plan (Recommended)
-
Open Power Options:
Or Run dialog (Win+R): -
Select
High performanceplan -
If not visible, click
Show additional plans -
Click
Change plan settings→Change advanced power settings -
Configure these settings:
🔋 Processor power management
├─ Minimum processor state: 100%
└─ Maximum processor state: 100%
🔌 USB settings
└─ USB selective suspend setting: Disabled
🎨 PCI Express
└─ Link State Power Management: Off
💤 Hard disk
└─ Turn off hard disk after: 0 (Never)
🖥️ Display
└─ Turn off display after: 10 minutes (or your preference)
💤 Sleep
├─ Sleep after: Never
└─ Hibernate after: Never
- Click
Apply→OK
Option B: Ultimate Performance Plan (Windows 10 Pro/Enterprise)
Even better than High Performance. Disables micro-power-saving features.
# Enable Ultimate Performance plan (Run as Administrator)
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61
# Set as active
powercfg -setactive e9a42b02-d5df-448d-aa00-03f14749eb61
# Verify
powercfg /list
Verify Power Plan¶
Expected output:
3️⃣ Real-Time System Tweaks¶
A. Disable Windows Search Indexing (Project Folders)¶
Why? Search indexing locks files during builds, causing compilation errors.
Method 1: Per-Folder
1. Right-click your project folder (e.g., C:\Dev\AudioLab)
2. Properties → Advanced...
3. Uncheck:
OK → Apply to all subfolders
Method 2: Exclude from Indexing Service
1. Control Panel → Indexing Options
2. Click Modify
3. Uncheck your development drives/folders
4. Click OK
B. Exclude Build Folders from Windows Defender¶
Why? Real-time scanning of build artifacts adds 50-200ms per file. A full rebuild can take 3x longer.
Add Exclusions:
# Run PowerShell as Administrator
# Exclude build folders
Add-MpPreference -ExclusionPath "C:\Dev\AudioLab\build"
Add-MpPreference -ExclusionPath "C:\Dev\AudioLab\cmake-build-*"
# Exclude JUCE folder (if local)
Add-MpPreference -ExclusionPath "C:\SDKs\JUCE"
# Exclude Visual Studio cache
Add-MpPreference -ExclusionPath "$env:LOCALAPPDATA\Microsoft\VisualStudio"
# Verify exclusions
Get-MpPreference | Select-Object -ExpandProperty ExclusionPath
⚠️ Security Note: Only exclude paths you control. Never exclude system folders.
C. Registry Tweaks for MMCSS (Multimedia Class Scheduler Service)¶
Why? MMCSS prioritizes audio threads. We need to increase the priority boost.
⚠️ Warning: Editing registry incorrectly can break Windows. Backup before proceeding.
Backup Registry:
# Create registry backup
reg export "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" "%USERPROFILE%\Desktop\MMCSS_backup.reg"
Apply Tweaks:
# Run as Administrator
# Increase MMCSS priority for Pro Audio
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio" /v "Priority" /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio" /v "Scheduling Category" /t REG_SZ /d "High" /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio" /v "SFIO Priority" /t REG_SZ /d "High" /f
# Increase system responsiveness (reduces background tasks)
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "SystemResponsiveness" /t REG_DWORD /d 10 /f
# Increase network throttling index (reduces network interference)
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile" /v "NetworkThrottlingIndex" /t REG_DWORD /d 4294967295 /f
Reboot Required: Restart Windows for changes to take effect.
Verify:
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio"
4️⃣ ASIO4ALL Configuration (If No Dedicated Interface)¶
Download: ASIO4ALL Official
⚠️ Note: ASIO4ALL is a last resort. Use a proper audio interface (RME, Focusrite, etc.) if possible.
Installation¶
- Download ASIO4ALL v2.15+ installer
- Run installer → Install for all users
- Reboot if prompted
Configuration¶
Open ASIO4ALL Control Panel:
- From your DAW: Options → Audio Settings → Click ASIO Control Panel button
- Or from Start Menu: ASIO4ALL v2 Instruction Manual → Control Panel
Settings:
🎚️ Buffer Size: 64-256 samples
├─ 64 samples = 1.33ms @ 48kHz (aggressive, may glitch)
├─ 128 samples = 2.67ms @ 48kHz (recommended start)
└─ 256 samples = 5.33ms @ 48kHz (safe, higher latency)
🔧 Hardware Buffer:
└─ Match ASIO buffer size (e.g., if ASIO = 128, set HW = 128)
⚙️ Advanced Options (click wrench icon):
☑️ Allow pull mode (WaveRT)
☐ Always Resample (keep OFF for best quality)
☑️ Force WDM driver (if needed for problematic devices)
Device Selection: 1. Expand your audio interface in device tree 2. Enable (click power button icon):
3. Disable all other devices to avoid conflictsVisual Guide (Text-based diagram):
┌─────────────────────────────────────────────────┐
│ ASIO4ALL v2.15 Control Panel │
├─────────────────────────────────────────────────┤
│ Buffer Size: [====|--------] 128 samples │
│ Latency: ⬅ 2.67ms (input) + 2.67ms (output) ➡ │
├─────────────────────────────────────────────────┤
│ 🔊 Realtek High Definition Audio │
│ ├─ 🔇 Microphone (Disabled) │
│ ├─ ✅ Line In 1/2 (Enabled) │
│ └─ ✅ Speakers 1/2 (Enabled) │
│ │
│ 🎧 USB Audio Device (Disabled) │
│ │
│ [Advanced Options ⚙️] [OK] [Cancel] │
└─────────────────────────────────────────────────┘
✅ Windows Configuration Checklist¶
After completing all steps, verify:
- Audio Exclusive Mode: Enabled for all devices
- Sound Enhancements: Disabled (
Disable all sound effectschecked) - Power Plan: High Performance or Ultimate Performance active
- USB Suspend: Disabled in power settings
- Processor State: 100% min/max
- PCI Link State: Off
- Indexing: Disabled on project folders
- Windows Defender: Build folders excluded
- MMCSS Registry: Pro Audio priority set to 1
- System Reboot: Performed after registry changes
- ASIO4ALL (if used): Configured with correct buffer size
Verification Test:
# Run LatencyMon for 5 minutes while DAW is active
# Download: https://www.resplendence.com/latencymon
Expected Results: - ✅ "Your system appears suitable for real-time audio" - ✅ Highest DPC latency < 500 μs - ✅ Highest ISR latency < 100 μs
🍎 macOS Ventura/Sonoma Setup¶
macOS has excellent audio support out-of-box (CoreAudio), but still needs configuration for low-latency development.
1️⃣ CoreAudio Optimization¶
A. Sample Rate Lock¶
Why? Prevents macOS from switching sample rates, which causes glitches.
Using Audio MIDI Setup:
1. Open Applications → Utilities → Audio MIDI Setup.app
2. Select your audio interface in left sidebar
3. Set Format:
Use This Device for Sound Output (optional)
Lock Sample Rate (Prevent Auto-Switching): - macOS will honor this setting for all apps - Some interfaces (RME, UAD) have hardware sample rate lock in driver settings
B. I/O Buffer Size Configuration¶
Why? Lower buffer = lower latency, but more CPU usage.
Method 1: Per-Application (DAW-specific) - Most DAWs (Logic Pro, Ableton, Reaper) have buffer size in preferences - Typical: 64-256 samples @ 48kHz
Method 2: System-Wide (via Terminal)
# Check current buffer size
system_profiler SPAudioDataType | grep "Buffer Frame Size"
# Set buffer size (requires app restart)
# Note: Not all devices respect this setting
defaults write com.apple.coreaudio HALBufferSize -int 128
Verification:
C. Aggregate Device Creation¶
Why? Combine multiple interfaces into one virtual device (e.g., interface inputs + BlackHole outputs).
Steps:
1. Open Audio MIDI Setup.app
2. Click + (bottom-left) → Create Aggregate Device
3. Name the device: AudioLab Aggregate
4. Check boxes for devices to combine:
Use in your DAW's audio settings
Example Use Case: - Inputs: Scarlett mic/line inputs - Outputs: Scarlett main outs + BlackHole (for analysis tools)
2️⃣ Permissions (macOS Privacy)¶
Why? macOS Sonoma+ requires explicit permission for audio I/O and accessibility features.
Grant Microphone Access¶
System Settings→Privacy & Security→Microphone- Enable for:
Grant Input Monitoring Access¶
Required for: Screen recording plugins, visualizer tools
System Settings→Privacy & Security→Input Monitoring- Enable for:
Grant Accessibility Access (If Needed)¶
Required for: Automation scripts, keystroke simulators
System Settings→Privacy & Security→Accessibility- Click
+→ Add your app → Enable
3️⃣ Terminal & Development Tools¶
A. Install Homebrew¶
What? Package manager for macOS (like apt/yum on Linux).
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add to PATH (for Apple Silicon Macs)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
# Verify
brew --version
B. Xcode Command Line Tools¶
Required for: Compiling C++ code, git, make, clang.
# Install Xcode CLT
xcode-select --install
# Verify
xcode-select -p
# Expected: /Applications/Xcode.app/Contents/Developer
# or: /Library/Developer/CommandLineTools
# Check clang version
clang --version
# Expected: Apple clang version 15.0.0+ (for Sonoma)
Full Xcode (Optional, 40+ GB): - Download from Mac App Store if you need Instruments (profiler) - Not required for command-line builds
C. Rosetta 2 (Apple Silicon Only)¶
Why? Some legacy plugins/tools are Intel-only. Rosetta 2 provides translation.
# Install Rosetta 2
softwareupdate --install-rosetta --agree-to-license
# Verify
arch
# Expected: arm64 (native) or i386 (Rosetta mode)
Running Apps in Rosetta:
1. Right-click app in Finder → Get Info
2. Check: ☑️ Open using Rosetta
3. Launch app
✅ macOS Configuration Checklist¶
- Sample Rate Locked: 48000 Hz in Audio MIDI Setup
- Buffer Size: Set in DAW preferences (128-256 samples)
- Aggregate Device: Created if using multiple interfaces
- Microphone Permission: Granted to DAW/tools
- Input Monitoring: Enabled for necessary apps
- Homebrew: Installed and in PATH
- Xcode Command Line Tools: Installed
- Rosetta 2: Installed (Apple Silicon only)
- BlackHole: Installed for virtual routing (if needed)
Verification Test:
# Check audio latency
# Open your DAW, set buffer to 64 samples @ 48kHz
# Expected round-trip latency: 3-6ms with proper interface
# Monitor system performance
sudo fs_usage | grep audio
# Should show minimal disk I/O during audio processing
🐧 Linux (Ubuntu/Arch) Configuration¶
Linux offers best real-time performance but requires more manual configuration.
1️⃣ Real-Time Kernel (Highly Recommended)¶
Why? Real-time kernel preemption = lower latency jitter (±50μs vs ±5000μs on generic kernel).
Ubuntu/Debian¶
# Install low-latency kernel
sudo apt update
sudo apt install linux-lowlatency
# Verify kernel after reboot
uname -r
# Expected: 5.15.0-XX-lowlatency or 6.x.x-lowlatency
Reboot:
Select Kernel on Boot (if not auto-selected):
1. Hold Shift during boot → GRUB menu
2. Select Advanced options for Ubuntu
3. Choose Ubuntu, with Linux 5.15.0-XX-lowlatency
Arch Linux¶
# Install real-time kernel
yay -S linux-rt linux-rt-headers
# Update bootloader
sudo grub-mkconfig -o /boot/grub/grub.cfg
# Reboot and select linux-rt kernel
sudo reboot
# Verify
uname -r
# Expected: 6.x.x-rt
2️⃣ JACK/PipeWire Setup¶
JACK = Traditional low-latency audio server PipeWire = Modern replacement (backwards-compatible with JACK)
Option A: PipeWire (Recommended for Modern Distros)¶
Ubuntu 22.04+:
# Install PipeWire and JACK compatibility
sudo apt install pipewire pipewire-jack wireplumber
# Enable PipeWire services
systemctl --user --now enable pipewire pipewire-pulse wireplumber
# Verify
pw-cli info all | grep "node.name"
# Should list audio devices
Configure Buffer Size:
# Edit PipeWire config
mkdir -p ~/.config/pipewire
cp /usr/share/pipewire/pipewire.conf ~/.config/pipewire/
# Edit ~/.config/pipewire/pipewire.conf
# Find default.clock.rate and set to 48000
# Find default.clock.quantum and set to 128 (or 64 for lower latency)
nano ~/.config/pipewire/pipewire.conf
Add these lines:
context.properties = {
default.clock.rate = 48000
default.clock.quantum = 128
default.clock.min-quantum = 64
default.clock.max-quantum = 2048
}
Restart PipeWire:
Option B: JACK (Traditional)¶
Install JACK2:
Configure JACK (via GUI):
Settings (click Setup button):
Sample Rate: 48000 Hz
Frames/Period: 128 (or 64 for lower latency)
Periods/Buffer: 2
Driver: alsa (Linux native)
Interface: hw:0 (or your interface name)
Advanced:
☑️ Realtime
Priority: 70
Start JACK:
- Click Start button in QjackCtl
- Status should show "Started"
3️⃣ Real-Time Privileges¶
Why? Without RT privileges, JACK/PipeWire cannot achieve low latency.
A. Create realtime Group¶
B. Add User to Audio Groups¶
# Add your user to audio and realtime groups
sudo usermod -aG audio $USER
sudo usermod -aG realtime $USER
# Verify
groups $USER
# Expected: ... audio ... realtime ...
C. Configure RT Limits¶
Edit /etc/security/limits.conf:
Add these lines (at the end):
@audio - rtprio 95
@audio - memlock unlimited
@audio - nice -19
@realtime - rtprio 95
@realtime - memlock unlimited
@realtime - nice -19
Explanation:
- rtprio 95: Real-time priority (max is 99, reserve 99 for kernel)
- memlock unlimited: Allow locking memory (prevents swapping)
- nice -19: Highest CPU scheduling priority for non-RT processes
Reboot Required:
Verify After Reboot:
4️⃣ Disable CPU Frequency Scaling (Optional but Recommended)¶
Why? CPU governor switching introduces latency spikes.
Check Current Governor:
Set to Performance Mode:
# Temporarily (until reboot)
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
# Permanently (install cpufrequtils)
sudo apt install cpufrequtils
# Edit /etc/default/cpufrequtils
sudo nano /etc/default/cpufrequtils
Add:
Apply:
5️⃣ ALSA Configuration (Advanced)¶
Tweak ALSA for Lower Latency:
Edit ~/.asoundrc (create if doesn't exist):
Add:
Explanation: - Forces ALSA to use hardware device directly (bypasses dmix/dsnoop) - Reduces latency by ~5-10ms
✅ Linux Configuration Checklist¶
- Real-Time Kernel: Installed (lowlatency or rt)
- Kernel Verified:
uname -rshows lowlatency/rt - PipeWire/JACK: Installed and configured
- Buffer Size: Set to 128 samples @ 48kHz (in PipeWire/JACK config)
- Real-Time Group: Created and user added
- Audio Group: User added
- RT Limits: Configured in
/etc/security/limits.conf - Limits Verified:
ulimit -rshows 95,ulimit -lshows unlimited - CPU Governor: Set to performance mode
- System Reboot: Performed after group/limit changes
Verification Test:
# Test JACK latency
jack_iodelay
# Expected output:
# 2.67 ms total roundtrip latency (at 128 frames/period)
# extra loopback latency: XX frames
# use XX for the backend arguments -I and -O
# Monitor system performance
sudo rtcqs # Install via: pip install rtcqs
# Should show all checks passed
🎯 Cross-Platform Verification¶
After configuring your OS, run these tests:
Test 1: Loopback Latency Test¶
Setup: Connect audio output → input (physical loopback cable or virtual loopback)
Windows:
macOS:
# Use BlackHole + AU Lab (built-in)
open /System/Applications/Utilities/Audio\ MIDI\ Setup.app
# Create aggregate device with loopback
Linux:
Expected Results: | Buffer Size | Sample Rate | Expected Latency (Round-Trip) | |-------------|-------------|-------------------------------| | 64 samples | 48 kHz | 2.67 ms | | 128 samples | 48 kHz | 5.33 ms | | 256 samples | 48 kHz | 10.67 ms |
Test 2: CPU Load Test¶
All Platforms: 1. Open your DAW 2. Load 20+ instances of a reverb plugin 3. Play audio for 5 minutes 4. Monitor CPU usage
Expected: - ✅ CPU < 70% average (leaves headroom) - ✅ Zero audio dropouts/glitches - ✅ Stable latency (no jitter)
📸 Visual Configuration References¶
Windows Sound Properties - Advanced Tab¶
┌──────────────────────────────────────────┐
│ Sound Properties - Advanced │
├──────────────────────────────────────────┤
│ Default Format: │
│ [24 bit, 48000 Hz (Studio Quality) ▼] │
│ │
│ Exclusive Mode: │
│ ☑️ Allow applications to take exclusive │
│ control of this device │
│ ☑️ Give exclusive mode applications │
│ priority │
│ │
│ [Apply] [OK] [Cancel] │
└──────────────────────────────────────────┘
macOS Audio MIDI Setup¶
┌────────────────────────────────────────────┐
│ Audio MIDI Setup │
├────────────────────────────────────────────┤
│ Devices: │
│ ├─ 🎵 Built-in Output │
│ ├─ 🎧 Focusrite Scarlett 4i4 ← Selected
│ └─ 🕳️ BlackHole 2ch │
│ │
│ Format: │
│ ├─ Sample Rate: [48000 Hz ▼] │
│ └─ Bit Depth: [24-bit Integer ▼] │
│ │
│ Input Channels: 4 │
│ Output Channels: 4 │
└────────────────────────────────────────────┘
Linux QjackCtl Setup¶
┌─────────────────────────────────────────┐
│ JACK Audio Connection Kit - Setup │
├─────────────────────────────────────────┤
│ Driver: alsa │
│ Interface: hw:0 │
│ Sample Rate: 48000 Hz │
│ Frames/Period: 128 │
│ Periods/Buffer: 2 │
│ │
│ ☑️ Realtime Priority: 70 │
│ ☐ Verbose │
│ │
│ [OK] [Cancel] │
└─────────────────────────────────────────┘
⚠️ What NOT to Touch¶
Windows¶
- ❌ Do NOT enable "Loudness Equalization" (destroys dynamics)
- ❌ Do NOT use "Balanced" or "Power Saver" power plans
- ❌ Do NOT enable "Fast Startup" (causes driver issues after reboot)
- ❌ Do NOT enable "Core Isolation" / "Memory Integrity" (adds latency)
macOS¶
- ❌ Do NOT enable "Use ambient noise reduction" in Sound settings
- ❌ Do NOT force quit
coreaudiod(it auto-restarts but causes glitches) - ❌ Do NOT run heavy background tasks (Time Machine, Spotlight indexing) during audio work
Linux¶
- ❌ Do NOT use PulseAudio for real-time work (use PipeWire or JACK)
- ❌ Do NOT set rtprio to 99 (kernel needs priority 99)
- ❌ Do NOT disable swap entirely (memlock unlimited handles this)
📝 Notes¶
Last Updated: October 2024 Tested On: - Windows 11 23H2 (Build 22631) - macOS Sonoma 14.5 - Ubuntu 22.04.3 LTS + 6.5.0-lowlatency kernel - Arch Linux (kernel 6.6.10-rt)
Recommended Reading: - Windows MMCSS Documentation - CoreAudio Programming Guide - Linux Audio Wiki
Next: IDE Setup - Configure Visual Studio, VSCode, and CLion for AudioLab development