Fix Sound Drivers for Raspberry Pi – Easy

Install the Sound Drivers

Update : The newer Debian “Wheezy” image enables the sound driver by default so this section is not needed to those that are using the newest version. Others that are having audio issues from previous versions of Raspian, see below.

In the Debian “Squeeze” image the ALSA sound drivers are considered experimental and have been disabled by default. To enable sound you need to type the commands below into the command line :

sudo apt-get install alsa-utils

That will install the required sound driver files and tools. Type “Y” when prompted. The following command will load the sound driver :

sudo modprobe snd_bcm2835

By default the output is set to automatically select the interface (HDMI if available otherwise analog). You can force it to use a specific interface using :

sudo amixer cset numid=3 <n>

Where <n> is the required interface : 0=auto, 1=analog, 2=hdmi. To force the Raspberry Pi to use the analog output :

sudo amixer cset numid=3 1

You will need to run the modprobe command again when your Pi is rebooted/restarted.

Playing A WAV File

In order to play a WAV file we need a file to play. Type the following command to download a test WAV file :

sudo wget http://www.freespecialeffects.co.uk/soundfx/sirens/police_s.wav

Now we can play it :

sudo aplay police_s.wav

If you are lucky the sound will play through your speakers or headphones.

I tried a number of WAV files but only some of them played. Hopefully this will be resolved in future releases of the sound drivers.

Source