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

Defaulting sound output to HDMI port



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?

I've tried searching the web, and found lots of stuff that makes
my eyes glaze over.  One site suggested creating /etc/asound.conf
and putting in the following lines:

defaults.pcm.card 1
defaults.ctl.card 1

This had no effect, even after a re-boot.

I tried creating ~/.asoundrc containing the following,
also with no effect:

pcm.!default {
    type hw
    card "NVidia"
}

ctl.!default {
    type hw
    card "NVidia"
}

I've tried using aplay, but I can't make the -D parameter work.
I get either "Channels count non available" or "No such file or
directory".

I'm using ALSA, not PulseAudio.  If I bring up alsamixer and
press F6, I get the following selections:

    .  (default)
    0  HDA Intel
    1  HDA NVidia
    2  IVTV-1
    3  IVTV-0
       enter device name...

If I select 1 (HDA NVidia), all I get are a couple of mute switches
labeled "S/PDIF" and "S/PDIF 1".  I've turned them both on.

Any suggestions as to where to go from here?
--
/~\  Charlie Gibbs                  |  Life is perverse.
\ /  <cgibbs@kltpzyxm.invalid>      |  It can be beautiful -
 X   I'm really at ac.dekanfrus     |  but it won't.
/ \  if you read it the right way.  |    -- Lily Tomlin


Reply to: