[SOLVED] Audio Setup through HDMI

New to Debian (Or Linux in general)? Ask your questions here!

[SOLVED] Audio Setup through HDMI

Postby czeekaj » 2018-01-16 01:07

Hello, I was having bit of trouble on debian 9 getting my audio going.
Using xfce was trying to route through the HDMI cable to my monitor which has a plug for speakers and headphones and my console so I like not to have to unplug my headphones everytime. I only need audio to go through HDMI which pulse did not work. and I can't read the config files and it has a cookie.
Maybe pulse will work with nvidea drivers but I figured out how to do with ALSA.

Couldn't figure it out spent a few hours trying to config ALSA.

I pretty rookie at this.

Update:
I installed Real teks drivers. Than pulseaudio.. still no Hdmi output but at least it doesn't sound flat out of my headphone jack. I'm assuming pulse might do it with nvidea's drivers.
Update2:
Code: Select all
 apt-get purge pulseaudio

I figured how to write my asound.conf So for the newbies out there like me here are the steps.
1. find audio devices.
aplay -l
Code: Select all
Card 0 PCH [HDA Intel PCH], Device 0 and 1 ALC 892 Analog and digital
Card 1  HDA NVidia Device 3 ,7 ,8 , 9 HDMI  0 , 1 ,2 ,3 

You will see a list like above what's importent is the card number and device number. in my case I had two cards and several Nvidea devices for all the ports. Easy to script.
2. set up default device
this will be your config file. It is in /etc/asound.conf
mine looks like this
Code: Select all
pcm.!defualt {
       type hw
       card 1
       device 7
 }
ctl.!default {
       type hw
       card 1
       device 7
}

In my case that's what I needed you can find out with a simple test with Alsa. In my case it told me device 7 was in use but still no audio with pulse must be a bug or something all other devices played but no audio.
Heres the Test to find out what your default should be.
Code: Select all
aplay -D plughw:1,7 /usr/share/sounds/alsa/test.wav
Replace 1,7 with yours as per the first step.
3. Configure your audio ;) like the second step if the file isn't there just create it as Root or Su.
/home/!yourusername!/.asoundrc
mine looks like this
Code: Select all
pcm.dmixer {
   type dmix
   ipc_key 1024
   ipc_key_add_uid false
   ipc_perm 0660
   slave {
      pcm "hw:1,7"
      rate 48000
      channels 2
      format S32_LE
      period_time 0
      period_size 1024
      buffer_time 0
      buffer_size 4096
      }
   }

pcm.!defualt {
      type plug
      slave.pcm "dmixer"
   }

:) Hope it works for you guys too. I read some guys making auto switch scripts. If it was bit easier it'd still be the go to audio, best of all you can read the scripts :).
czeekaj
 
Posts: 14
Joined: 2018-01-09 10:18

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable