RandomCoder
Posts: 20
Joined: Mon Jul 16, 2012 9:12 pm

HDMI Sound Issues

Mon Jul 30, 2012 7:13 pm

There seems to be a great many questions relating to HDMI sound not working, or doesn't work in this and that application. I know this because I've had my own fair share of problems and have decided to start this post to help others, and hopefully consolidate some of this information.
Ideally I would like others share there own solutions and then this could become a reference of 'known fixes'. Asking questions here is probably pointless as I'm not that familiar to using Linux and this is about the extent of my knowledge so far. As I find new problems and their solution I will add them here, and it would be good if others can add their own fixes to specific HDMI audio problems.

Distro: Debian Squeeze - No HDMI sound output at all
Install ALSA drivers which are not installed by default

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo apt-get alsa-utils
Distro: Debian Squeeze & Raspbian(Debian Wheezy) - No HDMI sound output at all
Enable the sound driver and force it to use HDMI

Code: Select all

sudo modprobe snd_bcm2835
sudo amixer cset numid=3 2
This will need to be done each time the RPi is rebooted, to avoid this add both lines into the modules file which is loaded when the RPi starts up

Code: Select all

sudo nano /etc/modules
Just omit the sudo before each command and keep each command on a seperate line.
Finally I found that the config.txt needed to be edited to force HDMI to use sound (some tv's cause the RPi set DVI as the preferred output which does not support sound)

Code: Select all

sudo nano /boot/config.txt
Add a new line containing the following text...
hdmi_drive=2
Then save and exit by pressing Ctrl+x followed by y and Enter
Test that the sound is working using the following command...

Code: Select all

sudo aplay /usr/share/sounds/alsa/Front_Center.wav
Application: Scratch - No sound effects
Edit the Scratch startup script

Code: Select all

sudo nano /usr/bin/scratch
Near the bottom of the file locate the following line...
# if pulseaudio is running, fall back to OSS
Now comment out the next 6 lines by inserting a # at the beginning of each line.
Next add a new line with the following text...
VMOPTIONS="$VMOPTIONS -vm-sound-alsa"
make sure to include the quotation marks and save then exit as described before
Application: SchismTracker - No sound when installed as per instruction given in TheMagPi Issue 2
Instead to downloading the app and extracting the files, it should be possible to install directly from the repositories...

Code: Select all

sudo apt-get install schism
I think that doing it this way brings with it any dependancies that Schism needs?
None of these solutions are my own work, all credit goes to those that have far more knowledge and experience than me :mrgreen:

Regards,
RandomCoder
"Defeat never comes to any man until he admits it."Josephus Daniels

Davidvm
Posts: 1
Joined: Tue Jul 31, 2012 6:00 pm

Re: HDMI Sound Issues

Tue Aug 07, 2012 5:53 pm

I found the article very helpful (having spent many hours of frustration trying to get sound out of my Pi).
There was one minor point I had to resolve - the lines to be entered into '/etc/modules' are:
snd_bcm2835
amixer cset numid=3 2
(i.e. the instruction 'modprobe' is not needed in the file).
Many thanks for the info.

maldrogado
Posts: 12
Joined: Thu Apr 18, 2013 11:47 am

Re: HDMI Sound Issues

Sat May 04, 2013 7:47 pm

Still not working for me. Raspbian wheezy. Have the RPi connected via hdmi to the TV (actually via an hdmi hub) and am controlling the RPi via Putty.

The strangest thing, though, is that earlier tonight I did get sound (a music file wth mplayer and then later mpg123). And it only happened after I plugged in headphones into the 3.5mm out (which caused the hdmi sound output to start working).

Up until that point, I hadn't done any configuring. Now I followed the steps in this guide. Nothing. Not with either of the two programs mentioned above. Not with aplay.

As a matter of fact, mplayer now freezes (after uncommenting the hdmi_drive=2 line) immediately upon launch. Earlier, it would output data to the console while running (but no sound was heard).

RandomCoder
Posts: 20
Joined: Mon Jul 16, 2012 9:12 pm

Re: HDMI Sound Issues

Sun May 05, 2013 3:43 pm

I'm new to Linux myself and so unable to give any direct advice, however I would try removing the HDMI hub just whilst setting up the RPi to make sure that it isn't causing you any problems then I'd follow some of the advice here.. https://github.com/raspberrypi/firmware/issues/139

Kind regards,
RandomCoder
"Defeat never comes to any man until he admits it."Josephus Daniels

DelusionalLogic
Posts: 3
Joined: Sat May 04, 2013 12:30 pm

Re: HDMI Sound Issues

Sun May 05, 2013 9:33 pm

These solutions did not fix my problem sadly. I have a separate thread with more information.

breaker
Posts: 28
Joined: Mon May 06, 2013 6:42 am

Re: HDMI Sound Issues

Mon May 06, 2013 8:34 am

Yes, I agree the sound over HDMI issue can be tricky. I just got my RPi model B rev.2 and put 2013-02-09 Raspbian on it. Sound didn't work with the default configuration when I attached the HDMI cable to my Olevia 232-S13 HDTV. Finding out why it wasn't working, and how to fix it was a winding path, but here is what I did.

I found the sound troubleshooting section on the Raspberry Pi wiki at eLinux.org:

http://elinux.org/R-Pi_Troubleshooting#Sound

I think it is a bit backward how they go about the troubleshooting, however. You see, I feel knowing which mode and what the modes mean would be helpful before attempting to play the sound files. At least the newest version of Raspbian has alsa installed and pulseaudio purged, as well as good sample audio files.

My television can go into various modes, some which don't send sound over HDMI by default. I knew HDMI included digital audio, but I didn't know it sometimes doesn't.

So, digging deeper, I moved to the configuration file:

http://elinux.org/R-Pi_ConfigurationFile

OK, but still not enough information, getting warmer, here is a list of all configuration file options:

http://elinux.org/RPi_config.txt

Yes! Finally is mentioned a command for gathering data, the first step in troubleshooting;

http://elinux.org/RPi_config.txt#Which_ ... monitor.3F
Which values are valid for my monitor?

Your HDMI monitor may support only a limited set of formats. To find out which formats are supported, use the following method.

Set the output format to VGA 60Hz (hdmi_group=1 hdmi_mode=1) and boot up the Raspberry Pi
Enter the following command to give a list of CEA supported modes

/opt/vc/bin/tvservice -m CEA

Enter the following command to give a list of DMT supported modes

/opt/vc/bin/tvservice -m DMT

Enter the following command to show your current state

/opt/vc/bin/tvservice -s

Enter the following commands to dump more detailed information from your monitor

/opt/vc/bin/tvservice -d edid.dat
/opt/vc/bin/edidparser edid.dat

The edid.dat should also be provided when troubleshooting problems with the default HDMI mode
So, I found my TV was not put in its "native" mode, but in a DMT mode. The option

Code: Select all

hdmi_drive=2
didn't seem to work in this mode to force audio. Going back to the sound troubleshooting, it was worth noting:
More reasons why sound does not work with an HDMI monitor

With an HDMI connection it might be possible to hear:

./hello_audio.bin 1

but not:

aplay /usr/share/sounds/alsa/Front_Center.wav
In fact, when I did get sound working, I had to play the file twice, once to "wake up" the TV, the again to verify it worked.

Moving on, I decided to force my TV's native mode, and the hdmi drive:

Code: Select all

hdmi_drive=2
hdmi_group=1
hdmi_mode=5
After that the

Code: Select all

./hello_audio.bin 1
worked as well as the alsa samples.

But actually the bar at the bottom of the OpenBox GUI on Raspbian flickers a bit now, so I may scrap all that and just go analog sound because the TV has an input near the HDMI and I have a 3.5mm stereo plug to RCA stereo adapter.

That's my journey...

Return to “Beginners”