Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I can't get the audio running. I don't hear anything and can not play anything.

Is there a solution to enable audio?

share|improve this question
7  
Please add more information to make this a more useful question for the future, even if it has already been answered. –  jandjorgensen Jun 12 '12 at 20:59
    
Distro tag required. As well as what audio output you are trying to use. –  Jivings Jun 12 '12 at 22:54
1  
Guidelines: stackoverflow.com/questions/how-to-ask Luckily the current best answer is broad enough to cover your question. However, it's better for future users of the site if you give your specific setup to allow for a specific answer. –  jandjorgensen Jun 13 '12 at 18:14
    
My problem was low volume for master output. –  user6158 Feb 23 '13 at 19:12
add comment

3 Answers

up vote 30 down vote accepted

Sound does not work with an HDMI monitor

This is caused by some computer monitors which select DVI mode even if an HDMI cable is connected. This fix may be necessary even if other HDMI devices work perfectly on the same monitor (or TV)! Edit the configuration file - see the instructions at Raspberry-Pi Configuration File.
Add the following line to the configuration file:

hdmi_drive=2

Sound does not work at all, or in some applications

Sound is disabled by default because the ALSA sound driver is still "alpha" (not fully tested) on the R-Pi. To try out sound, from the command prompt before "startx", type

 sudo apt-get install alsa-utils
 sudo modprobe snd_bcm2835
 sudo aplay /usr/share/sounds/alsa/Front_Center.wav

By default output will be automatic (hdmi if hdmi supports audio, otherwise analogue). You can force it with:

sudo amixer cset numid=3 <n>

where n is 0=auto, 1=headphones, 2=hdmi. If you are running Debian, try

cd /opt/vc/src/hello_pi/hello_audio
 make
 ./hello_audio.bin

to test analogue output. And to test HDMI.

./hello_audio.bin 1

Also note that you may have to add your user to the 'audio' group to get permission to access the sound card.

Making the changes permanent

sudo apt-get install alsa-utils is permanent, but sudo modprobe snd_bcm2835 only initialises the driver for the current session. To ensure the module is initialised on boot, add snd_bcm2835 to /etc/modules (source).

share|improve this answer
2  
aplay -l is also a useful command for enumerating if any ALSA devices exist. –  stsquad Jun 21 '12 at 13:42
1  
This is outdated information as of Jan 2013. alsa-utils is installed by default, and lsmod shows snd_bcm2835 is there without having to do anything. –  CaptSaltyJack Jan 3 '13 at 17:38
    
Maybe so, but the problem might still occur on old devices and some distros –  Itay Grudev Jan 4 '13 at 0:51
    
I had snd-bcm2835 in /etc/modules when it should have been snd_bcm2835. Once I changed that, it worked. –  daviewales Jun 5 '13 at 4:21
add comment

This is a common bug. I think what's breaking ALSA is PulseAudio. If you want to use ALSA (Default, recommend by Tux) use sudo apt-get remove PulsueAudio

For other fixes, try the wiki. It all depends. Try this first (as this is the most common)

share|improve this answer
add comment

I ran into a problem where sound did not work or static played instead of my recording. But it was a problem with my approach, not the Pi itself. I'm using Raspbian 3.6.11 (2013-02-09-wheezy-raspbian).

Primarily, I tried to play an MP3 file with aplay, which only seems to support WAVs. Also, some of the MP3 files I used may not have been created with a compatible codec. To test the sound output on your Pi, I found it best to the sample audio files that come with the Raspbian OS. Also ensure that you use a player appropriate for the audio format. For example:

  • Use aplay for .wav files. For example: aplay /usr/share/scratch/Media/Sounds/Vocals/Singer2.wav (there are lots of sample audio files in /usr/share/scratch/Media/Sounds).
  • Use omxplayer or mpg123 for .mp3 files. For example: use omxplayer /usr/share/scratch/Media/Sounds/Effects/WaterDrop.mp3 or alternatively mpg123 /usr/share/scratch/Media/Sounds/Effects/WaterDrop.mp3 (If you don't already have mpg123, you should be able to install it with the command sudo apt-get install mpg123).
  • Use amixer to control the volume output. For example: amixer cset numid=1 50% sets the headphone jack volume output to fifty percent.

For more information on audio out commands, I found the following web site useful: http://blog.scphillips.com/2013/01/sound-configuration-on-raspberry-pi-with-alsa

For what it's worth, I was also experiencing a popping sound caused by a voltage jump when the audio starts and stops. That issue is now fixed in the Pi firmware.

share|improve this answer
    
AFAIK that bug should have been fixed in one of the audio driver updates ... –  Itay Grudev Mar 21 '13 at 20:21
1  
You're right. I was probably just doing it wrong, but others may have the same issue, so I've updated my post with my findings. Thanks Itehnological! –  Steve HHH Mar 25 '13 at 18:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.