Introduction: Change the Name and Index of the Sound Card in Raspberry Pi

About: Systems Administrator and Software Programmer.

Introduction

In my "Use USB Sound Card in Raspberry Pi" instructable, Raspberry Pi assigned my ALSA Card id as number 1 even though it was the only sound card installed. ALSA defines a default card as having card index number 0. Since the linux kernel assigned the sound card as index number 1, therefore, there is no default card in my Raspberry Pi. This is an inconvenience but not a show-stopper because I can specify the sound device as "plughw:1,0". There is a way to instruct the linux kernel to assign any card with any number index. This instructable will show how.

Another thing that can be improved is the name of the Sound Card. The USB sound card that I installed was given the name "Pro", which is not descriptive of the sound card. I prefer giving it a name such as "SbXfi51Pro". This instructable will also show how to give it a nice name

Scope

This instructable will cover the following:

  • Specify an index number for the Sound Card Id
  • Specify an name for the Sound Card Id
  • Use ALSA utilities to test sound card and sound device

This instructables will NOT cover the following

  • PulseAudio
  • Open Sound System (OSS)

Specifications

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: Test Sound Card and Speakers Work

Complete the steps in "Test Sound Card and Speakers in Raspberry Pi" instructable.

Step 2: Discover Parameters of the Kernel Module Available for the USB Sound Card

Open terminal:

modinfo snd_usb_audio | grep parm

Refer to the screenshot.

The Card ID's index is set by the parameter called "index".

The Card ID's name is set by the parameter called "id". The maximum length of the characters is 12 and only alphanumeric characters are recognised.

Step 3: Specify the Number Index and Name to the USB Sound Card ID

Open terminal

cd /etc/modprobe.d
sudo vi alsa-base.conf

Enter the lines as show in the screenshot.

Save the file.

Reboot the Raspberry Pi.

Step 4: Test That Changes Have Taken Effect

Open terminal:

aplay -l

Refer to screenshot The changes have taken place.