Raspberry Pi Audio: ALSA, PipeWire, DAC HATs, and Bluetooth Setup

audio configuration on raspberry pi

Raspberry Pi audio setup on Bookworm involves choosing an output device, selecting it in ALSA or PipeWire, and testing with aplay. On Raspberry Pi OS Desktop, PipeWire replaces PulseAudio as the default audio server. PulseAudio commands like pactl and pavucontrol still work through the PipeWire compatibility layer. One important hardware note: the Raspberry Pi 5 has no 3.5mm headphone jack. Pi 5 users need HDMI audio, a USB DAC, or an I2S DAC HAT for analog audio output. This guide covers all five audio output options, correct Bookworm configuration for each, I2S DAC HAT setup, Bluetooth audio pairing, and the most common troubleshooting fixes.

Last tested: Raspberry Pi OS Bookworm Desktop 64-bit | May 2025 | Raspberry Pi 4 Model B (4GB) and Raspberry Pi 5 (8GB) | ALSA 1.2.8, PipeWire 0.3.65, HiFiBerry DAC+ Standard

Key Takeaways

  • Raspberry Pi 5 has no 3.5mm audio jack. This is a hardware change from Pi 4 and earlier. If you need analog audio output on a Pi 5, use HDMI (which carries audio to a display with speakers), a USB DAC/audio adapter, or an I2S DAC HAT via the 40-pin header.
  • Raspberry Pi OS Bookworm Desktop uses PipeWire as the default audio server, not PulseAudio. PipeWire’s PulseAudio compatibility layer means pactl, pavucontrol, and other PulseAudio tools continue to work. Do not install the pulseaudio package alongside PipeWire. They conflict.
  • I2S DAC HATs like the HiFiBerry series do not require compiling kernel modules. Enable them by adding a dtoverlay line to config.txt. The device tree overlay loads the correct I2S driver automatically at boot.

Raspberry Pi Audio Output Options

Raspberry Pi audio output options: 3.5mm jack, HDMI, USB DAC, I2S DAC HAT, and Bluetooth -- models, quality, and setup method

3.5mm headphone jack is available on Pi 4 and earlier. It uses the BCM SoC’s PWM audio output, which produces adequate quality for casual listening but is audibly noisy due to switching interference from the board’s power circuitry. For permanent installations or any project where audio quality matters, replace it with a USB DAC or I2S HAT.

HDMI audio works on all Pi models. The Pi sends audio through the HDMI signal to a monitor or TV with built-in speakers, or to an AV receiver. Pi 4 has two micro-HDMI ports; Pi 5 has two standard HDMI ports. On Pi 5, HDMI is the only built-in analog-equivalent output since there is no 3.5mm jack.

USB DAC/audio adapter works on all Pi models and is the simplest path to clean analog audio. Any class-compliant USB audio device (no driver required) plugs in and appears as an ALSA sound card. USB DACs range from $10 dongles to audiophile converters. Connect one, run aplay -l, and select it as the default output.

  • Durable USB C to 3.5mm Audio Adapter: The Braided USB C Headphone Adapter connects USB Type C phones/tablets/laptops to …
  • Optimal Hi-Fi Sound Quality: This USB C to Aux Adapter supports up to 24bit/96KHz while others are 16bit/48Khz, with pow…
  • Convenient In-Line Control: This Type C to Aux Adapter supports all 3.5mm earphones, and it can support in-line control …

I2S DAC HAT connects via the 40-pin GPIO header and bypasses the Pi’s onboard audio circuitry entirely. I2S transmits raw digital audio from the Pi’s SoC to the DAC chip on the HAT for conversion. HiFiBerry, Allo, and IQaudio all make I2S DAC HATs at various price and quality levels. The HiFiBerry DAC+ Standard is the most commonly recommended entry-level I2S DAC.

Bluetooth audio is available on Pi 3, Pi 4, and Pi 5 via the built-in Bluetooth radio. Pair a Bluetooth speaker or headphones using bluetoothctl and configure it as the default audio sink in PipeWire or PulseAudio. Bluetooth audio on Pi has a known latency issue for video/audio sync, but is generally fine for music playback.

Configuring Raspberry Pi Audio on Bookworm

Start by listing all available audio playback devices:

aplay -l

The output lists each card and device. A Pi 4 with a USB DAC plugged in shows three entries: the HDMI output (card 0), the Pi’s analog/PWM output (card 1), and the USB DAC (card 2). The card number and device number are needed for ALSA configuration.

Test a specific card directly:

# Play a test tone on card 0, device 0:
speaker-test -c 2 -t wav -D hw:0,0

# Play an audio file on a specific card:
aplay -D hw:2,0 /usr/share/sounds/alsa/Front_Center.wav

To set a default audio output permanently, edit or create /etc/asound.conf (system-wide) or ~/.asoundrc (per-user). Set the default device by card number:

# ~/.asoundrc  set USB DAC (card 2) as default:
pcm.!default {
    type hw
    card 2
}
ctl.!default {
    type hw
    card 2
}

Expected result: After saving ~/.asoundrc, running aplay /usr/share/sounds/alsa/Front_Center.wav without specifying a card plays through the USB DAC. If no sound comes out, check aplay -l to confirm the card number is correct. Card numbers can shift if devices are plugged in or out.

Volume control on Bookworm Desktop uses the PipeWire/PulseAudio stack. The right-click menu on the taskbar volume icon or pavucontrol (install with sudo apt install pavucontrol) provides a full graphical mixer. For command-line volume control:

# List sinks (output devices):
pactl list sinks short

# Set volume on a sink (100% = 65536):
pactl set-sink-volume @DEFAULT_SINK@ 80%

# Unmute:
pactl set-sink-mute @DEFAULT_SINK@ 0

# ALSA mixer (works on any install including Lite):
alsamixer

On Raspberry Pi OS Lite (no desktop), PipeWire is not installed. Audio goes through ALSA directly. Use alsamixer for volume and aplay for playback. Install alsa-utils if missing: sudo apt install alsa-utils.

I2S DAC HATs and Bluetooth Audio on Raspberry Pi

  • 【Perfect Fit for Compact Boards】Specifically designed to fit perfectly onto the Raspberry Pi Zero, Zero W, Zero 2, and Z…
  • 【Extensive Software Compatibility】Ready to work with all popular Raspberry Pi music player systems such as Volumio, Mood…
  • 【High-Performance DAC & Amp Combo】Equipped with the PCM5122 32-bit/384kHz high-resolution DAC for exceptional audio clar…

I2S DAC HAT setup. Seat the HAT on the 40-pin header. No additional wiring is required. Enable the HAT’s device tree overlay in config.txt. On Pi 4, edit /boot/config.txt. On Pi 5, edit /boot/firmware/config.txt.

First, disable the Pi’s onboard audio and add the HAT overlay. For a HiFiBerry DAC+:

# Comment out or remove:
# dtparam=audio=on

# Add:
dtoverlay=hifiberry-dacplus

Reboot. Verify the HAT is detected:

aplay -l

Expected result: The HiFiBerry DAC appears in the aplay -l output as a sound card. Set it as the default output in ~/.asoundrc using its card number. The HAT’s audio quality is noticeably cleaner than the Pi’s 3.5mm jack. Common HiFiBerry overlays: hifiberry-dac (DAC), hifiberry-dacplus (DAC+), hifiberry-dacplusadc (DAC+ ADC for input). Check the HiFiBerry documentation for the exact overlay name for your model.

For MoOde Audio and Volumio internet radio images, the DAC HAT is configured in the image’s audio settings menu by selecting the HAT model. No manual config.txt editing is needed. For the full MoOde setup, see Raspberry Pi Internet Radio with MoOde: Setup and Configuration Guide.

Bluetooth audio pairing. Pair a Bluetooth speaker using bluetoothctl:

sudo bluetoothctl
power on
agent on
scan on
# Find your device's MAC address in the scan output, then:
pair XX:XX:XX:XX:XX:XX
connect XX:XX:XX:XX:XX:XX
trust XX:XX:XX:XX:XX:XX
exit

On Bookworm Desktop, the paired device appears automatically as an audio sink in PipeWire. Select it in the taskbar volume icon or in pavucontrol. For auto-reconnect on boot, the trust command above is required. Install bluez and bluez-tools if bluetoothctl is missing:

sudo apt install -y bluez bluez-tools

For multi-room audio where multiple Raspberry Pis synchronise audio playback within milliseconds, Snapcast is the correct tool. See Multi-Room Audio with Snapcast on Raspberry Pi. For text-to-speech audio output from Python, see Text to Speech Raspberry Pi with Piper: Setup and Engine Comparison.

Troubleshooting Raspberry Pi Audio

No sound output. Run aplay -l to confirm audio devices are detected. If no cards are listed, the audio hardware is not loaded. On Pi OS Desktop, check that PipeWire is running: systemctl --user status pipewire. On Lite, check that ALSA modules are loaded: lsmod | grep snd. If the output is empty, reload: sudo modprobe snd-bcm2835 for the Pi’s onboard audio.

Volume is set but no audio comes out. The most common cause on Bookworm is a muted channel. Run alsamixer, press F6 to select the correct card, and check that the Master and PCM channels are not muted (MM at the bottom means muted; press M to unmute). If using PipeWire, run pactl list sinks short and verify the default sink is the intended output device.

Wrong output device selected. On Bookworm Desktop with multiple audio outputs (HDMI + USB DAC, for example), audio may default to the wrong device after a reboot. Set the default persistently in ~/.asoundrc for ALSA applications, or set the default sink in PipeWire via pactl set-default-sink [sink-name]. Right-click the taskbar volume icon and select the output device for an immediate switch without editing files.

I2S DAC HAT not detected after config.txt change. Confirm the edit was saved to the correct file (Pi 4: /boot/config.txt, Pi 5: /boot/firmware/config.txt). Confirm the overlay name is correct for the exact HAT model. Check HiFiBerry’s or your HAT manufacturer’s documentation for the precise dtoverlay= value. Run dmesg | grep -i hifiberry after boot to see if the driver loaded. If nothing appears, the overlay name is wrong or the HAT is not seated correctly.

Audio on Pi 5: no 3.5mm jack. Pi 5 has no analog audio output via a headphone jack. Connect speakers or headphones via HDMI (to a display with speakers), via a USB audio adapter, or via an I2S HAT. The aplay -l output on a bare Pi 5 without HDMI shows no analog output device. This is expected. Plug in a USB audio adapter and it appears immediately as a new card.

Bluetooth audio stutters or drops. The Pi’s Bluetooth and WiFi share the same antenna on the BCM radio. Simultaneous WiFi and Bluetooth audio can cause interference and audio dropouts. Reduce WiFi channel width or move the Pi closer to the router to reduce WiFi retransmissions. On Pi 4 and Pi 5, a USB Bluetooth adapter on a different frequency band can improve Bluetooth audio stability by offloading Bluetooth from the shared radio.

FAQ

Does Raspberry Pi 5 have a headphone jack?

No. The Raspberry Pi 5 removed the 3.5mm headphone jack that was present on Pi 4 and earlier models. For analog audio output on Pi 5, use HDMI audio (the display or receiver provides the speakers), a USB audio adapter (any class-compliant USB DAC plugs in without a driver), or an I2S DAC HAT such as the HiFiBerry DAC+ connected via the 40-pin header.

What audio server does Raspberry Pi OS Bookworm use?

Bookworm Desktop uses PipeWire as the default audio server, replacing PulseAudio from earlier Raspberry Pi OS releases. PipeWire includes a PulseAudio compatibility layer, so tools like pavucontrol, pactl, and applications that use the PulseAudio API continue to work without modification. Do not install the pulseaudio package on a Bookworm Desktop system. It conflicts with PipeWire. Bookworm Lite does not include PipeWire and uses ALSA directly.

How do I get better audio quality from Raspberry Pi?

Replace the 3.5mm jack with a USB DAC or I2S DAC HAT. The Pi’s built-in PWM audio output is the weakest in the lineup. Any class-compliant USB audio device plugs in and provides cleaner output immediately. For the best quality, an I2S DAC HAT bypasses the Pi’s onboard audio entirely and provides bit-perfect digital-to-analog conversion. The HiFiBerry DAC+ Standard delivers 192kHz/24-bit output at a modest cost. For audiophile builds, MoOde Audio with an I2S DAC HAT is the standard combination.

How do I set a default audio output on Raspberry Pi?

Create or edit ~/.asoundrc and add the ALSA default device block with the card number from aplay -l. For PipeWire/PulseAudio on Desktop, use pactl set-default-sink [sink-name] where the sink name comes from pactl list sinks short. The Desktop taskbar volume icon also lets you switch the active output device with a right-click. The ~/.asoundrc change persists across reboots; the pactl change may reset on reboot unless added to a startup script.

How do I connect Bluetooth speakers to Raspberry Pi?

Use bluetoothctl: run power on, scan on, note the speaker’s MAC address, then pair, connect, and trust using that address. On Bookworm Desktop, the paired speaker appears as an audio sink in PipeWire automatically. Run trust XX:XX:XX:XX:XX:XX before exiting bluetoothctl to enable auto-reconnect on subsequent boots. Install bluez and bluez-tools if bluetoothctl is not available on a Lite install.

References:


About the Author

Chuck Wilson has been programming and building with computers since the Tandy 1000 era. His professional background includes CAD drafting, manufacturing line programming, and custom computer design. He runs PidiyLab in retirement, documenting Raspberry Pi and homelab projects that he actually deploys and maintains on real hardware. Every article on this site reflects hands-on testing on specific hardware and OS versions, not theoretical walkthroughs.

Last tested hardware: Raspberry Pi 4 Model B (4GB) and Raspberry Pi 5 (8GB). Last tested OS: Raspberry Pi OS Bookworm Desktop 64-bit. ALSA 1.2.8, PipeWire 0.3.65, HiFiBerry DAC+ Standard.