Page 1 of 1
[SOLVED] Get sound from HDMI
Posted: 22 Nov 2011, 14:11
by oranus
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..
Re: Get sound from HDMI
Posted: 22 Nov 2011, 19:38
by brokenman
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
Re: Get sound from HDMI
Posted: 25 Nov 2011, 15:55
by oranus
Thanks for help brokenman
I deal with problem.
And I write script for any computer to set sound master to HDMI.
Re: Get sound from HDMI
Posted: 25 Nov 2011, 19:03
by fanthom
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
Re: Get sound from HDMI
Posted: 25 Nov 2011, 19:16
by brokenman
And I write script for any computer to set sound master to HDMI.
Gonna share?
Re: Get sound from HDMI
Posted: 27 Nov 2011, 09:45
by oranus
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.
Re: Get sound from HDMI
Posted: 02 Mar 2012, 02:14
by edge226
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.