[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Defaulting sound output to HDMI port



On Vi, 07 ian 22, 11:43:34, Charlie Gibbs wrote:
> I have a computer in the living room which is hooked up to our TV
> via an HDMI cable.  I use it to play MP3s, videos, and games.
> Our TV is hooked to our stereo system to get good-quality sound.
> However, audio isn't passing through the HDMI connection from the
> computer; to get sound I've run a separate cable from the computer's
> headphone jack to an auxiliary input on the stereo system, and I have
> to switch the stereo to this input to get sound.  It's not the end of
> the world, but it would be nice to send the audio via HDMI so I can
> just switch the TV's input and leave the stereo set to the TV.
> 
> I'm running Buster with xfce.  Here's some system information:
> 
> cjg@dragon:~$ uname -a
> Linux dragon 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20)
> x86_64 GNU/Linux
> cjg@dragon:~$ cat /proc/asound/cards
>  0 [Intel          ]: HDA-Intel - HDA Intel
>                       HDA Intel at 0xe5320000 irq 27
>  1 [NVidia         ]: HDA-Intel - HDA NVidia
>                       HDA NVidia at 0xe5000000 irq 17
>  2 [IVTV1          ]: CX2341[56] - IVTV-1
>                       CX2341[56] #1 WinTV PVR 500 (unit #2) TV/FM
> Radio/Line-In Capture
>  3 [IVTV0          ]: CX2341[56] - IVTV-0
>                       CX2341[56] #0 WinTV PVR 500 (unit #1) TV/FM
> Radio/Line-In Capture
> cjg@dragon:~$ aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: Intel [HDA Intel], device 0: STAC9271D Analog [STAC9271D Analog]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 0: Intel [HDA Intel], device 1: STAC9271D Digital [STAC9271D Digital]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
>   Subdevices: 1/1
>   Subdevice #0: subdevice #0
> 
> After searching the web and mpv's man page, I found that the following
> command would play sound through the computer's HDMI port:
> 
> cjg@dragon:~$ mpv --audio-device=alsa/hdmi:CARD=NVidia,DEV=0 foo.mp3
> 
> Obviously there's nothing wrong with my hardware.  Is there any
> setting that will make audio output default to the HDMI port?

From memory, there are actually several ways to do this.

My preferred method is via kernel module options. E.g. for a system 
where I had the opposite problem (sound would default to HDMI instead of 
the on-board sound, both handled by the snd-hda-intel module) I have 
this:

$ cat /etc/modprobe.d/snd-hda-intel-index.conf 
# change order of devices
options snd-hda-intel index=1,0

(a rebuild of the initramfs and a reboot is required as far as I recall)

There are various other values possible, including negative (e.g. if a 
specific device should always have lower priority).


The same should be possible by (re-)defining the 'default' output in 
ALSA, usually with some /etc/asound.conf or ~/.asoundrc magic (a quick 
search points to the same entries you already tried), though I'm not 
sure how that will interact with PulseAudio and/or various applications 
using ALSA directly.


Hope this helps,
Andrei
-- 
http://wiki.debian.org/FAQsFromDebianUser

Attachment: signature.asc
Description: PGP signature


Reply to: