Raspberry Pi Zero WH with external USB sound card

Robert Guiscard
2 min readNov 21, 2018

--

I recently got a Raspberry Pi Zero WH and realized it has no audio jack output. So I got this USB sound card which claims to work with Linux. I also got a OTG USB 2.0 hub so that it can connect regular-size USB to mini-USB. Once everything is put together, check to see whether Raspberry Pi Zero WH can recognize the USB sound card

$> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 7/7
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

Great! The USB sound card is the card number 1. There is an article detailing how to get it to work. In short, just edit the file /usr/share/alsa/alsa.conf

defaults.ctl.card 1 # change 0 to 1
defaults.pcm.card 1

That’s it. Now I can add music to mpd database and play it with sound coming out of USB sound card. But mpc volume control doesn’t work !! There is a solution.

First, check the mixer of your device, either with amixer scontrols or amixer -c 1

$> amixer scontrols
Simple mixer control 'Speaker',0
Simple mixer control 'Mic',0
Simple mixer control 'Auto Gain Control',0
$> amixer -c 1
Simple mixer control 'Speaker',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 37
Mono:
Front Left: Playback 4 [11%] [-33.00dB] [on]
Front Right: Playback 4 [11%] [-33.00dB] [on]
Simple mixer control 'Mic',0
Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined
Playback channels: Mono
Capture channels: Mono
Limits: Playback 0 - 31 Capture 0 - 35
Mono: Playback 16 [52%] [-7.00dB] [off] Capture 20 [57%] [8.00dB] [on]
Simple mixer control 'Auto Gain Control',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]

The mixer is called “Speaker”. Change the mixer name in /etc/mpd.conf

audio_output {
type "alsa"
name "My ALSA Device"
device "hw:1,0" # optional
mixer_type "hardware" # optional
mixer_device "default" # optional
# mixer_control "PCM" # optional
mixer_control "speaker" # optional
mixer_index "0" # optional
}

Now, the volume control from mpc works.

--

--