[SOLVED] Get sound from HDMI

Non release banter
User avatar
oranus
Contributor
Contributor
Posts: 69
Joined: 25 Aug 2011, 13:46
Location: Turkey

[SOLVED] Get sound from HDMI

Post#1 by oranus » 22 Nov 2011, 14:11

I couldn't get sound from HDMI. I find my Nvidia HDMI driver from kmix gui. But I can't send sound to my TV from HDMI.

How can I get sound from HDMI?

Thanks for advance..
Last edited by oranus on 09 Apr 2012, 07:30, edited 1 time in total.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Get sound from HDMI

Post#2 by brokenman » 22 Nov 2011, 19:38

please issue from console: alsamixer and ensure your card is being correctly detected and all volumes are unmuted (use 'm' to unmute). If you make changes then run: alsactl

Use: aplay -L to see which devices can give sound. Do you see HDMI anywhere in there?
aplay -l will give you the device number of the HDMI card. Then use alsamixer -c <number> to try to configure the settings.

You can test devices with: speaker-test -c 2 -r 48000 -D hw:X,X where X is a device number or using mplayer.

Lastly ... using the info above add a file called ~/.asoundrc andn add:

Code: Select all

pcm.!default {
type hw
card 0
device 9
}
ctl.!default {
type hw
card 0
device 9
}
Be sure that your TV accepts the Khz range you are sending to it. You may need to refer to the TV manual for this. You could perhaps set the Khz in the asoundrc file. be warned that this asoundrc file takes precedence of alsa.conf once you create it (judging by reading the code in alsa.conf).

For some indepth info please follow the footsteps of those that fought before you:
http://www.linuxquestions.org/questions ... page2.html
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
oranus
Contributor
Contributor
Posts: 69
Joined: 25 Aug 2011, 13:46
Location: Turkey

Re: Get sound from HDMI

Post#3 by oranus » 25 Nov 2011, 15:55

Thanks for help brokenman

I deal with problem. :good: And I write script for any computer to set sound master to HDMI.

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

Re: Get sound from HDMI

Post#4 by fanthom » 25 Nov 2011, 19:03

here is my output:

Code: Select all

guest@porteus:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: STAC92xx Analog [STAC92xx Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
guest@porteus:~$
as you can see HDMI is definied as 'card 0, device3'. i have failed to redirect all sounds to the TV (different apps uses different settings) but here is mplayer syntax (i'm also using vaapi feature of my i3 CPU)

Code: Select all

mplayer -vo vaapi -va vaapi -ao alsa:device=hw=0.3
now i have sound from the movie redirected to the TV and all other sounds stays muted on the laptop :)

Cheers
Please add [Solved] to your thread title if the solution was found.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Get sound from HDMI

Post#5 by brokenman » 25 Nov 2011, 19:16

And I write script for any computer to set sound master to HDMI.
Gonna share?
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
oranus
Contributor
Contributor
Posts: 69
Joined: 25 Aug 2011, 13:46
Location: Turkey

Re: Get sound from HDMI

Post#6 by oranus » 27 Nov 2011, 09:45

I'm newbie on scripting....

Please correct script if you see any errors....
thanks...

Code: Select all

#!/bin/bash
echo HDMI device are searching. ..
echo It takes a few minutes....
sleep 2
clear
Find_sound()
{
yer=/root/.asoundrc
if [ -f $yer ]
then
rm $yer
fi

for(( k = 0; k <= 1; k++ ))
do
for(( i = 1; i <= 10; i++ ))
do
ses=`mplayer -ao alsa:device=hw=$k.$i /usr/share/sounds/k3b_success1.wav 2>/dev/null |grep Starting |wc -l`
if [ $ses -eq 1 ]
then

echo 'Do you hear sound from HDMI device? y/n'
#`typeset - var`
read var

if [ "$var" == "y" ]
then
echo HDMI device has just find...
echo Settings done...
echo 'pcm.!default {' >>/root/.asoundrc
echo 'type hw' >>/root/.asoundrc
echo 'card '$k >>/root/.asoundrc
echo 'device '$i >>/root/.asoundrc
echo '}' >>/root/.asoundrc
echo 'ctl.!default {' >>/root/.asoundrc
echo 'type hw' >>/root/.asoundrc
echo 'card '$k >>/root/.asoundrc
echo 'device '$i >>/root/.asoundrc
echo '}' >>/root/.asoundrc
echo HDMI device ready...
sleep 2
exit 0
fi
fi
done
done
}

Find_sound
clear
echo HDMI Device are not found....
sleep 2
echo 'You should set your HDMI device configuration manually...'
sleep 2
echo Please remove Item: [off] section by pressing m   
echo Use right arrow to enter another HDMI device and remove all [off] written section... 
sleep 10
echo After finish settings press ESC...  
HDMI=`aplay -l | grep HDMI |awk {'print $3'} |head -n 1 `
alsamixer -c $HDMI

clear
echo HDMI device are searching again....
sleep 2
Find_sound

Posted after 5 minutes 7 seconds:
Generally Nvidia HDMI device settings are initally off. So I have to change settings from alsamixer...

I can't find to set HDMI device setting "on" from cli yet.

edge226
Contributor
Contributor
Posts: 98
Joined: 27 Feb 2012, 23:55
Location: Canada

Re: Get sound from HDMI

Post#7 by edge226 » 02 Mar 2012, 02:14

The posted script did not work for me, modifying alsamixer then storing the settings and manually changing .asoundrc enabled sound however I have no volume control other than the hardware on the TV.

Post Reply