You are not logged in.

#1 2016-01-25 11:03:18

kyoni
Member
Registered: 2016-01-24
Posts: 8

[SOLVED] no sound when connected to HDMI Monitor

Hello,

disclaimer:

I'm new here and not sure yet if and how to post wiki pages for such a subject...
but in case somebody ever ran into a trouble like mine, I wanted to give you my solution...

the symptom: no sound once a HDMI Monitor has beem connected
the setup : connecting a HMDI(DVI) Monitor to my computer
the reason : HDMI seems to set itself as the default output for sound, even if the Monitor is no capable of sound (not a TV)


the solution :

as HDMI sets itself as the main (first) sound device, it is chosen as the default sound output by everything,
to verify this:

aplay -l | grep card

card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
card 1: PCH [HDA Intel PCH], device 0: ALC668 Analog [ALC668 Analog]

The device that shows up as "card 0" is the default.
In our case we don't want HDMI to be default, so we need to force this to change.

First thing to do, blacklist everything related to hdmi-sound (don't blacklist the graphics, though):
get all your hdmi sound modules

lsmod | awk '$1 ~ /snd/ && $1 ~ /hdmi/'

snd_hda_codec_hdmi     49152  1

blacklist every offending line in /etc/modprode.d/ by creating a new "[choosename].conf"
I chose /etc/modprobe.d/hdmi-blacklist.conf

blacklist snd_hda_codec_hdmi

Now we need to find out the names of our sound outputs:

cat /proc/asound/modules

 0 snd_hda_intel
 1 snd_hda_intel

In this case there are 2 modules, and worse: they are named the same...

with our "aplay -l | grep card" from above, we already know that one output is "type" HDMI and the other is "type" PCH...
so we need to set the order in which they load

/etc/modprobe.d/hdmi-alsa.conf
options snd-hda-intel id=PCH index=0
options snd-hda-intel id=HDMI index=1

as we modified the blacklists we now need to reboot our linux...
after reboot the cards show up like this:

aplay -l | grep card

card 0: PCH [HDA Intel PCH], device 0: ALC668 Analog [ALC668 Analog]
card 1: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]

This should help no matter what sound "system" you use: pure ALSA (like me), PulseAudio, OSS, ... as the above configuration sets the primary "hardware" to use.
If some software wants to use something different from ALSA, the above will ensure the right default output is used, no matter what: PCH before HDMI.


For ALSA-only configs like mine... here is my /etc/asound.conf

pcm.!default {
    type plug
    slave.pcm "primary"
}

ctl.!default {
    type hw
    card PCH
}

pcm.primary {
 	type dmix
 	ipc_key 10248406
 	slave {
		pcm "hw:0,0"
		period_time 0
		period_size 1024
		buffer_size 4096
		rate 44100
	}
}

the "ctl.!default" was set like this on purpose, that way I can control the soundvolume at it's final output, just before the signal is sent to my speakers/headphones/...

(I must admit I didn't play around with the settings inside "pcm.primary" : ipc_key, periods, buffers, rates, ... I took them "as-is".)

You will need to set 'pcm "hw:0,0" ' , according to this:

aplay -l | grep card

card 0: PCH [HDA Intel PCH], device 0: ALC668 Analog [ALC668 Analog]
card 1: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]



I hope somebody found this helpful smile

Last edited by kyoni (2016-01-25 11:09:23)

Offline

#2 2016-01-25 12:24:23

fjvinal
Member
From: Madrid
Registered: 2012-06-23
Posts: 45

Re: [SOLVED] no sound when connected to HDMI Monitor

I have the same problem with HDMI sound with an Intel card. Analogic output works perfect, and that is what I am using now.
I think that it is a ploblem of the intel kernel driver. With LTS kernel HDMI sound works better.

Offline

#3 2016-01-25 13:23:25

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [SOLVED] no sound when connected to HDMI Monitor

You could remove the asound.conf (and you definitely shouldn't blacklist the hdmi codec if you ever intend to use it), since default configuration already invokes dmix for card 0,0 and since you adjusted the order with the indices in the modprobe.conf file it will be used regardless. This is already covered in the wiki: https://wiki.archlinux.org/index.php/Ad … sound_card Also I'm relatively sure that your second line in the modprobe file isn't getting parsed, but this doesn't matter since you already define the correct index to 0 first. The correct way, which would consider all your devices would be something like

options snd_hda_intel id=PCH,HDMI index=0,1

Please don't take this personally, it's a good first post, which shows some research and willingness to learn which is definitely welcome here and most of the things you mention here aren't strictly wrong, there's just a few redundancies that could be avoided for the simple purpose of switching the default device away from HDMI.

Offline

#4 2016-01-25 15:25:12

kyoni
Member
Registered: 2016-01-24
Posts: 8

Re: [SOLVED] no sound when connected to HDMI Monitor

thank you for your suggestion V1del smile

the "options snd_hda_intel id=PCH,HDMI index=0,1" does not seem to work...

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel PCH], device 0: ALC668 Analog [ALC668 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

This mixes HDMI and PCH in a really weird way... not sure that's good.


If I remove the asound.conf (the file), the sound does not get send to dmix: only one application can play sound, the others get an "is busy" message.
with this asound.conf I can have multiple applications play sound at the same time, with ALSA + dmix only... and the output is sent to my laptop speakers/headphones correctly
However, if you were suggesting merging the "pcm.!default" and "pcm.primary" ... this does not work:

pcm.!default {
    type dmix
    slave.pcm "hw:0,0"
}

...it only allows for 1 app to play sound... maybe my syntax is wrong?

this however works:

pcm.!default {
    type dmix
    ipc_key 10248406
    slave {
               pcm "hw:0,0"
               period_time 0
               period_size 1024
               buffer_size 4096
               rate 44100
    }
}



I'm aware that, with the hdmi blacklisting, I really shut off the hdmi-sound...
That's its purpose: I really, really never want to use it, and I want to be certain no application on my computer ever tries to use it.

Last edited by kyoni (2016-01-25 15:37:39)

Offline

Board footer

Powered by FluxBB