Introduction: Use USB Sound Card in Raspberry Pi
I bought a Sound Blaster X-Fi Surround 5.1 Pro recently at a Computer Fair because it was on offer. Before I bought it, I researched how good is its Linux support.It was promising so I bought it. This instructable will show how to install this sound card. Generally, it applies to other brands of USB sound card. Check how good is its Linux support before buying it.
This instructable will cover the following:
- Install the USB Sound Card
- Use ALSA utilities to test sound card and sound device
This instructables will NOT cover the following
- Open Sound System (OSS)
My Raspberry Pi:
- Raspberry Pi 2 model
- Raspbian based on Debian Version 8.0 (a.k.a Jessie)
- Advanced Linux Sound Architecture Driver Version k4.1.10-v7+
- Pulse Audio and OSS are NOT installed
- 2 speakers connected to Raspberry Pi's audio/video 3.5mm socket.
Step 1: Disable Raspberry Pi's Built-in Sound Chip
This step is optional. I prefer disabling the broadcom sound chip so that I can isolate and troubleshoot the USB sound card.
Complete the steps in "Disable the Built-in Sound Card of Raspberry Pi" instructable.
Step 2: Install the USB Sound Card
The Raspberry Pi should detect the USB Sound Card and load the kernel module (device driver) automatically. However, this is not guaranteed. So I need to check.
sudo tail -f /var/log/messages
Refer to screenshot. The lines are irrelevent because I have not connected the USB Sound Card to Raspberry Pi yet.
Connect the USB Sound Card to Raspberry Pi and observe the output of terminal. Refer to second screenshot.
The following line indicates that Raspberry Pi has detected the USB Sound Card:
Oct 14 12:38:15 rpiproj4 kernel: [ 2460.232593] usb 1-1.5.6: Product: SB X-Fi Surround 5.1 Pro
Step 3: Check That Kernel Module (Device Driver) Was Loaded Automatically
Accoding to alsa-project.org the kernel module name for this sound card is snd-usb-audio (or snd_usb_audio).
Check that his kernel module was automatically loaded.
lsmod | grep snd_usb_audio
Refer to screenshot. The snd_usb_audio was listed so it means kernel module was loaded by Raspberry Pi.
Step 4: Discover the ALSA Card Id and Device Id of the USB Sound Card
Display ALSA playback device
The ALSA Card Id is "Pro" or number 1. Not a very descriptive name. Refer to screenshot.
The ALSA Card has 2 devices:
- First Device Id is 0
- Second Device Id is 1
This USB sound card has line-in for microphone. So there should be a corresponding ALSA capture device
There is one ALSA Capture device. Cards. Card id = Pro or number 1 | Device Id = 0. Refer toscreenshot.
Step 5: Test by Sending Sound Stream to ALSA Playback Device
Make sure speakers are connected to the USB Sound Card and that Speakers are powered-up.
speaker-test -Dhw:1,0 -c2 -twav
If the speakers put out a lady's voice that say:
FRONT LEFT and FRONT RIGHT on both speaker, then the Sound Card is successfully installed.
We have a be nice policy.
Please be positive and constructive.