Plugable USB

Raspberry Pi USB Audio Connection

by Lewis Loflin

(Above) The Plugable adaptor was purchased from Amazon.

Update September 2020. Because of changes to Raspbian Buster I can no longer get it work with USB audio. I'll update this when I can find out what they did.

The system now uses volti mixer and one can still switch between the 3.5mm jack or HDMI with raspi-config from the command line.

This video refers to the older method no longer used.

Here we will explore how to connect a Raspberry Pi to a USB audio device. The advantage of doing this is less load on the RPi processor and I believe better performance. The same programming modification worked for a Plugable USB adaptor with the added bonus of a mono microphone input. This also worked on my generic USB speakers as shown in the above video.

Alsamixer on Raspberry Pi.

Open a terminal program and type "alsamixer" and the above should open. Use your up/down, left/right keys to control audio and microphone level. If using USB speakers there will be no microphone control.

If USB is not displayed select F6 to see if USB is in the menu. If not the USB device is not being detected. Power down and and plug/unplug device. Power back up and check again.

Caution: when USB audio is unplugged with power on defaults to HDMI.

Going Deeper

Assuming a USB audio device is plugged in Raspberry Pi has three audio outputs: the jack, HDMI, plus USB. The idea is for the user to select the output, not plug and pray it works.

When the jack audio out isn't working it may be switched to HDMI. From command line to change to the output jack or USB:

~ $ amixer cset numid=3 1 (enter)

0 is automatic;
1 is output jack;
2 is HDMI

We don't want to do this every time we power up. Open a text editor and copt/paste the following code:

To use USB audio (plugable) open in text editor and paste the following code:

# file .asoundrc 

pcm.!default {
	type hw
	card 0 # change to 1 for USB

ctl.!default {
	type hw
	card 0 # change to 1 for USB

Save as .asoundrc in your $HOME. Not this is a hidden file. This does not effect HDMI audio.

1 is USB: 0 is broadcom hardware. That is all there is.

Also open the following in text editor but really isn't needed unless adding new programs, etc. I never bother with this.

~ $ sudo geany /usr/share/alsa/alsa.conf

Change from output jack:

defaults.ctl.card 0
defaults.pcm.card 0


defaults.ctl.card 1
defaults.pcm.card 1

Save and then reboot. Test sound.

Note if playing videos such as h264/mpg4 you need to buy the codec for MPEG-2 or VC-1 from Raspberry Pi. This according to the literature.

Fact is I can play YouTube videos on Chromium just fine. Same with videos on VLC.

I tested mine in mp3 audio files.

My retrovol mixer doesn't doesn't work with USB audio. Lxpanel tray audio control does. You can also use pnmixer for tray audio with Tint2/openbox or JWM window managers.

Use alsamixer in terminal to check audio source. HDMI and the output jack come back as broadcom hardware.

AlsaMixer GUI on Raspberry Pi.

Above is the graphical version of alsamixer called Pimixer.

This is a collection of programs and hardware hacks related to mainly Raspberry Pi and Debian Linux.