How to get HDMI Sound in MAC MINI 2011 Ubuntu,MX Linux,LXLE, LUBUNTU
1) Open console and type: aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: CS4206 Analog [CS4206 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: CS4206 Digital [CS4206 Digital]
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: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 0/1
Subdevice #0: subdevice #0
macunan@maurihp:~$
Since we are interested in getting HDMI sound I tried the following combinations until I heard sound:
aplay -D plughw:card,device /usr/share/sounds/alsa/Front_Center.wav
aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav
aplay -D plughw:0,7 /usr/share/sounds/alsa/Front_Center.wav
aplay -D plughw:0,8 /usr/share/sounds/alsa/Front_Center.wav
I finally got some hdmi sound with the following combination
aplay -D plughw:0,8 /usr/share/sounds/alsa/Front_Center.wav
3) Edit and create the following file: sudo nano /etc/asound.conf
defaults.pcm.card 0
defaults.pcm.device 8
Save and close and reboot and next time you should have hdmi sound :-)
4) In case you need to use the speaker just rename the above file and /etc/asound.conf and reboot and you will have macmini speaker back.
Also note I used Kernel 4.18 you should I least have that version and all the drivers will be configured properly
Created bash script to change you should execute with sudo
Execute like sudo sh restart_sound.sh, also chance your settings on the script and your username in my case is macunan should change to your distro home user
ispeaker=`sudo grep 8 /etc/asound.conf`
if ["$ispeaker" = ""]; then
echo "entro en if"
pcm_0=`sudo echo "defaults.pcm.card 0">/etc/asound.conf`
pcm_8=`sudo echo "defaults.pcm.device 8">>/etc/asound.conf`
else
echo "entro en else"
pcm_0=`sudo echo "defaults.pcm.card 0">/etc/asound.conf`
pcm_8=`sudo echo "defaults.pcm.device 0">>/etc/asound.conf`
fi
sudo runuser -l macunan -c 'pulseaudio -k'
sudo alsa force-reload