Here are a few pointers on how to make the sound work on Raspberry Pi. I’ve gathered these bits and pieces along the way of using this tiny computer.
First of all – Arch Linux for ARM (i.e. alarm) is the best distro I’ve used on RasPi so far. Lightweight, starts in just a few seconds, has a lots of packages and you can install it just the way you want. And this is also the distro for which I am writing this short How-To.
How to add the sound module
To make the system see the integrated sound card you need to load the appropriate kernel module. Like so:
sudo modprobe snd_bcm2835
To check whether it is loaded, just check the output of lsmod. The command written above has to be executed every time the system starts. To make it “stick”, add the module to the list of automatically loaded modules. That is create a new file /etc/modules-load.d/sound.conf containing just a single line:
snd-bcm2835
That’s it. The sound module should now load every time you start your RasPi.
How to install Alsa
Most of the programs will be able to output sound using Alsa. To install it, issue this command:
sudo pacman -S alsa-utils alsa-plugins alsa-lib alsa-firmware
Now you can run speaker-test and it should produce a nice white noise on your speakers.
How to enable analog sound
If you want to select which sound output should be used (HDMI or analog 3.5mm jack), the command to use for Alsa and analog output is:
sudo amixer cset numid=3 1
Or substitute the last “1” for “2” if you want HDMI.
How to make VLC or mplayer work with Alsa
If you are getting messages like this:
alsa audio output error: cannot commit hardware parameters: Invalid argument jack audio output error: failed to connect to JACK server main audio output error: no suitable audio output module
All you have to do is fix the sound card configuration via creating a simple *.conf file: /etc/asound.conf with the following content:
pcm.!default { type hw card 0 } ctl.!default { type hw card 0 }
For more info, take a look at this: http://elinux.org/R-Pi_Troubleshooting#Sound
2 replies on “Raspberry Pi – sound HOW-TO”
I agree that the best distro is Arhc. I put reference for your guide to overall guide how install Arch on Raspberry Pi and then make it work for Music jukebox.
I’d like to get my RPi’s audio throughput to my PC speakers. Mainly because I’m not too keen on my TV’s sound quality. I was for a while, but after I plugged my speakers back in in, it was like, “WHAT WERE YOU THINKING????!?!” Anyhow, I use my Pi for openELEC, and I’d like to have my movies’ audio go through my PC speakers, but without having to plug and unplug every time I switch between the two (My PC is RIGHT next to my TV, but I like the set top box experience of the Pi for my “movie going” pleasures…