DSP Hardware
The DSP is a dedicated audio coprocessor:| Feature | Value |
|---|---|
| Clock Speed | 81 MHz |
| Architecture | Custom 16-bit DSP |
| IRAM | 8192 x 16-bit instructions |
| DRAM | 4096 x 16-bit data words |
| DMA | Bidirectional to main RAM |
Source/Core/Core/DSP/
Emulation Modes
Dolphin supports two DSP emulation approaches:- HLE (High-Level)
- LLE (Low-Level)
Location:
Core/DSP/DSPHLE/Default and recommended. Emulates DSP behavior without running actual DSP code:Advantages
- Very fast (low CPU usage)
- No DSP ROM required
- Compatible with 95%+ of games
- Deterministic
How It Works
- Intercepts DSP UCode (microcode) uploads
- Identifies known UCode types (AX, Zelda, etc.)
- Reimplements UCode functionality in C++
- Outputs audio samples directly
Supported UCodes
- AX: Most common (Luigi’s Mansion, Mario Kart, etc.)
- Zelda: Zelda-specific (Wind Waker, Twilight Princess)
- Card: Memory card operations
- InitAudioSystem: Boot-time initialization
- ROM: IPL/BIOS DSP code
Audio Pipeline
Audio flows through these stages:Game Sends Audio Commands
PowerPC CPU sends commands to DSP via mail interfaceLocation:
Core/DSP/DSP.cpp- Write to DSP mailbox registers
- Upload UCode to IRAM
- Send DMA commands for audio buffers
DSP Processes Audio
DSP runs UCode to process samplesHLE: C++ implementation mimics UCode
LLE: Execute actual DSP instructions
- Decode audio (ADPCM, PCM)
- Apply effects (reverb, delay, filters)
- Mix multiple channels
- Output to DMA buffer
Audio Interface Streams
Audio Interface (AI) streams from DMA bufferLocation:
Core/HW/AudioInterface.cpp- 32 KHz sample rate (AI default)
- Stereo output (left/right channels)
- Trigger AI interrupts on buffer completion
Audio Backends
Location:Source/Core/AudioCommon/
Dolphin supports multiple audio output backends:
| Backend | Platforms | Description |
|---|---|---|
| Cubeb | All | Cross-platform (recommended) |
| WASAPI | Windows | Windows Audio Session API |
| PulseAudio | Linux | Linux standard |
| ALSA | Linux | Advanced Linux Sound Architecture |
| OpenAL | All | OpenAL Soft |
| OpenSLES | Android | Android native audio |
| Null | All | No output (testing) |
Configuration
Cubeb (Recommended)
Mozilla’s cross-platform audio library:- Low latency
- Reliable on all platforms
- Automatic device switching
- Minimal CPU overhead
Audio Settings
Key audio configuration options:DSP Emulation Engine
DSP Emulation Engine
Choose between HLE and LLE:Default: HLE (fast, compatible)
Use LLE when: Game has audio issues with HLE
Audio Latency
Audio Latency
Buffer size in milliseconds:
- Lower (10-20ms): Less delay, more CPU, potential underruns
- Higher (50-100ms): More delay, less CPU, smoother audio
Stretching
Stretching
Time-stretch audio to match emulation speed:Useful when emulation runs slower than 100% speed.
DPL II Decoding
DPL II Decoding
Dolby Pro Logic II decoder:Upmixes stereo to 5.1 surround.
DSP UCode Types
Common UCode implementations in HLE:AX UCode
Location:Core/DSP/DSPHLE/UCodes/AX.cpp
Most common UCode for game audio:
- Multiple voice channels (up to 64)
- ADPCM and PCM decoding
- Volume, pitch, and pan control
- Effects: reverb, chorus, delay
- Surround positioning
- Luigi’s Mansion
- Mario Kart: Double Dash
- Super Smash Bros. Melee
- Most GameCube/Wii games
Zelda UCode
Location:Core/DSP/DSPHLE/UCodes/Zelda.cpp
Zelda-specific audio:
- Sequenced music playback
- Sound effect triggering
- Custom mixing
- The Legend of Zelda: Wind Waker
- The Legend of Zelda: Twilight Princess
- The Legend of Zelda: Four Swords Adventures
Card UCode
Memory card audio operations (beeps).Audio Debugging
Enable audio logging:User/Dump/Audio/ and User/Dump/DSP/.
Performance Tuning
- Fast Performance
- Low Latency
- Accuracy