You are not logged in.

#1 2019-12-01 17:38:39

ThinkPad
Member
Registered: 2019-01-29
Posts: 33

[SOLVED] Sound works through HDMI but not through laptop speakers

I am using only using ALSA and alsa-utils for my sound purposes.


Background:
I need to configure my laptop to play audio through HDMI for presentations. To do this I followed these instructions. My working config for outputting to HDMI is as follows:

~/.asoundrc
----
defaults.pcm.card 0
defaults.pcm.device 7
defaults.ctl.card 0

Before this, and when the file is not present, sound works out of laptop speakers.


Problem:
Sound no longer plays out of laptop speakers. I am able to trigger sound out of laptop speakers using:

aplay -D plughw:0,0 /usr/share/sounds/alsa/Front_Center.wav

The terminal bell does sound through the speakers, but not any media like youtube videos. I also tried adding my user to the group audio after reading this post even though our problems are slightly different. After reboot the problem prevails.

I would like to have a setup where I can specify, if no HDMI, play through laptop speakers (maybe first priority default and second priority default). Even simpler would be to have a command aliased for outputting audio to HDMI and another for returning output to my laptop speakers the same way I output video through xrandr using:

alias mirrord='xrandr --output HDMI-2 --auto --same-as eDP-1 --mode 1920x1080'

Outputs:

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

Last edited by ThinkPad (2019-12-07 21:39:10)

Offline

#2 2019-12-02 08:51:34

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 8,003

Re: [SOLVED] Sound works through HDMI but not through laptop speakers

Make a script and assign a hotkey to move that file to another name and back, then restart all currently audio using applications.

If you actually want this to happen dynamically and during active runtime of audio, remove that file and install pulseaudio and pulseaudio-alsa instead. Pulseaudio has facilities to properly handle this with hotplugging and falling over on HDMI connect/disconnect, maybe also install pavucontrol to have a visual of how pulse handles devices.

Offline

#3 2019-12-07 21:38:48

ThinkPad
Member
Registered: 2019-01-29
Posts: 33

Re: [SOLVED] Sound works through HDMI but not through laptop speakers

Excellent thank you!

Offline

Board footer

Powered by FluxBB