How to do audio via HDMI

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
tone
Posts: 28
Joined: Sun 25 Jul 2010, 22:42

How to do audio via HDMI

#1 Post by tone »

This topic starts from the situation created in http://murga-linux.com/puppy/viewtopic.php?t=93949 where I installed AMD Drivers (fglrx).
I used Precise Puppy 5.7.1 (kernel 3.9.11) on Motherboard "ASUS_E35M1-M PRO" with "AMD Radeon HD 6310": it's connected via HDMI to a TV LED.

I can see the situation of devices running in the shell the following command

Code: Select all

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 0: ALC887-VD Analog [ALC887-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: SB [HDA ATI SB], device 3: ALC887-VD Digital [ALC887-VD Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
HDMI is the default's device

//
In alsamixer "S/PDIF" is: "MM"
Turn it on with the key "M" (now is "00")

With the following commands you hear the sound

Code: Select all

mplayer -ao alsa:device=hw=0.3 /usr/share/audio/ivy.mp3
aplay -D plughw:0,3 /usr/share/audio/beep_high.wav
With the following commands you don't hear the sound

Code: Select all

mplayer /usr/share/audio/ivy.mp3
aplay /usr/share/audio/beep_high.wav
You can't hear the sound in the browser.

//
Now I must hear the audio also in the browser and adjust the volume with alsamixer.
If you are interested in the various steps, see section "STEP BY STEP PROCEDURE"
If you are not interested in the various steps, see section "QUICK PROCEDURE"

------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
STEP BY STEP PROCEDURE

Create the file /etc/asound.conf with the following content:

Code: Select all

pcm.!default {
type hw
card 0
device 3
}
To enter the value of "card" and "device" I saw the output of the command "aplay -l" above

With the following command you hear the sound (don't need reboot)

Code: Select all

mplayer /usr/share/audio/ivy.mp3
With the following command you don't hear the sound

Code: Select all

aplay /usr/share/audio/beep_high.wav
I can listen to the audio in the browser

//
For the next modifications I was inspired from the following sites:
Softvol
http://alsa.opensrc.org/Softvol
Speaker-test
http://alsa.opensrc.org/Speaker-test
How to use softvol to control the master volume
http://alsa.opensrc.org/How_to_use_soft ... ter_volume

Now in alsamixer there's only the "S/PDIF" voice

//
To verify that I'm using the right device:

Code: Select all

speaker-test -Dhdmi:Generic -c2 
you hear a rustle in the left, then in the right

to determine "-D"

Code: Select all

aplay -L
hdmi:CARD=Generic,DEV=0
    HD-Audio Generic, HDMI 0
    HDMI Audio Output
(I showed just what concerns HDMI)

//
add to /etc/asound.conf

Code: Select all

pcm.softvol {
    type            softvol
    slave {
        pcm         "hdmi:Generic"
    }
    control {
        name        "HDMI"
        card        0
    }
}
To enter the value of pcm (slave) I saw the output of the command "aplay -L" above.
To enter the value of "card" I saw the output of the command "aplay -l" above.

To check if the change is successful run

Code: Select all

speaker-test -Dsoftvol -c2
you hear a rustle in the left, then in the right


Now appears in alsamixer the volume bar "HDMI" (to see the new bar is need to run the command above. I haven't studied the reason).
With alsamixer I can adjust the volume to the command above...but you can't adjust the volume in the browser.


//
To adjust the volume in the browser
replace in /etc/asound.conf

Code: Select all

pcm.!default {
type hw
card 0
device 3
}
with

Code: Select all

pcm.!default {
    type             plug
    slave.pcm       "softvol"
}
With the following commands you hear the sound

Code: Select all

mplayer /usr/share/audio/ivy.mp3
aplay /usr/share/audio/beep_high.wav
Now I can listen to the audio in the browser and adjust the volume with alsamixer (don't need reboot).

------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
QUICK PROCEDURE

Create the file /etc/asound.conf with the following content

Code: Select all

pcm.!default {
    type             plug
    slave.pcm       "softvol"
}
pcm.softvol {
    type            softvol
    slave {
        pcm         "hdmi:Generic"
    }
    control {
        name        "HDMI"
        card        0
    }
}
To see in alsamixer the new "HDMI" bar, is need to run (I haven't studied the reason)

Code: Select all

mplayer /usr/share/audio/ivy.mp3
aplay /usr/share/audio/beep_high.wav
With the above commands you hear the sound.

Now I can listen to the audio in the browser and adjust the volume with alsamixer (don't need reboot).

If reboot, everything works!
...and now, listen to Rock and Roll!!

8) 8) 8) 8)

maxvolodya
Posts: 1
Joined: Mon 08 Dec 2014, 00:24

Re: Audio via HDMI

#2 Post by maxvolodya »

tone wrote:This topic starts from the situation created ...
sorry for my English. i never been at tshis forum. but i registraded specially for say to you, tone, THANKYOU! I search three days to find how to use ( :-) don't know better word for this) volume in alsa with hdmi-monitor-speackers. Here this my quest ends. and i'm happy

thank you very much )

User avatar
neerajkolte
Posts: 516
Joined: Mon 10 Feb 2014, 07:05
Location: Pune, India.

#3 Post by neerajkolte »

Welcome to the forum @maxvolodya.

Not knowing english is not a problem, feel free to post your problems or solutions.
If you really feel the need use Google translator.

I am new too.
This forum and it's friendly member's have helped me a lot.

Thanks.

- Neeraj.
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson

“We tend to overestimate the effect of a technology in the short run and underestimate the effect in the long run.â€￾
- Amara’s Law.

tone
Posts: 28
Joined: Sun 25 Jul 2010, 22:42

#4 Post by tone »

Hello maxvolodya, I'm happy that the topic has helped you.
Thanks to you for having shared your :) with the forum!

Post Reply