Universal HDMI Sound (...Plug n' Play 4 Porteus)

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
User avatar
brokenman
Site Admin
Site Admin
Posts: 5553
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Static HDMI (...Out Of The Box Audio)

Post#31 by brokenman » 03 May 2015, 23:19

Well, it is kind of an important element of Porteus and we are seeing more and more people having problems due to dual sound setups. Today I sorted the whole Analog/HDMI thing on my laptop.
I now have some udev rules that automatically send video to HDMI when it is plugged. I also have a script that will ask which card you want to use and give you a test. Works fine for me on three machines tested.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
blue4meridian
Shogun
Shogun
Posts: 279
Joined: 29 Sep 2014, 05:58
Distribution: 64bit LxQt (Plastique/Mikachu)
Location: Jersey City N.J. USA

Re: Static HDMI (...Out Of The Box Audio)

Post#32 by blue4meridian » 04 May 2015, 00:58

Salutations... :good:

@brokenman... Outstanding... :oops: does your script allow for
saving (eg. persistance?) the result of the audio card choice?

Best Regards... :beer:

User avatar
brokenman
Site Admin
Site Admin
Posts: 5553
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Static HDMI (...Out Of The Box Audio)

Post#33 by brokenman » 04 May 2015, 15:54

If you are saving changes then it will persist. If not then it won't. The whole idea is that user needs to swap sound devices so persistence is not really appropriate. Also if you have a USB install that moves from machine to machine then a persistent asound.conf is no good.

For people that boot into fresh mode and want to select a sound card and keep it persistent, just copy the resulting alsa config file into the rootcopy folder and you're done.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
blue4meridian
Shogun
Shogun
Posts: 279
Joined: 29 Sep 2014, 05:58
Distribution: 64bit LxQt (Plastique/Mikachu)
Location: Jersey City N.J. USA

Re: Solved:Static HDMI (...Out Of The Box Audio)

Post#34 by blue4meridian » 05 May 2015, 01:37

Salutations... :good:

Well stated. However...I'm curious. :oops: does that mean you are using the Google (AndroidOS) approach?
Namely... when you connect Android's HDMI to a TV the Android device automatically switches to HDMI sound.
There is no need to choose cards or do configuration. Android uses HDMI sound for TV and analog for every thing else.
If not... what do I need to do to get a Plug n' Play result? I haven't had time yet to research Google's solution.

Best Regards... :beer:

User avatar
brokenman
Site Admin
Site Admin
Posts: 5553
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Solved?:Static HDMI (...Out Of The Box Audio)

Post#35 by brokenman » 05 May 2015, 14:58

Yes, on my machine I have made it possible to send the video and sound to HDMI when HDMI is plugged in. I don't use it though. I prefer the video to go to the monitor but the sound to stay on the laptop (kickass Harman Kardon speakers). It is really not so difficult to script this, but there is some buginess when scripts are run via udev.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
blue4meridian
Shogun
Shogun
Posts: 279
Joined: 29 Sep 2014, 05:58
Distribution: 64bit LxQt (Plastique/Mikachu)
Location: Jersey City N.J. USA

Re: Solved?:Static HDMI (...Out Of The Box Audio)

Post#36 by blue4meridian » 06 May 2015, 01:03

Salutations... :good:

IMHO... :oops: I make this suggestion as a recording engineer
w/ over 30 years experience (I once did a project for Columbia/Sony).
There are other ways of getting analog distortion ("warmth").

Such as... use the output of your TV instead of the device.
Because your TV is designed to output sound to speakers.
If you need distortion use an analog preamp (or amplifier).

That noted... you said your script queries before doing Plug n' Play.
What is needed for automated connection (Google's solution)?

Best Regards... :beer:

User avatar
brokenman
Site Admin
Site Admin
Posts: 5553
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Solved?:Static HDMI (...Out Of The Box Audio)

Post#37 by brokenman » 07 May 2015, 01:08

Completely automated plug n play is just a matter of using xrandr to find the HDMI device.
xrandr | awk '/ connected/{print$1}'
And using aplay -l to find the HDMI sound device using the output of the above command (E.g HDMI1).
Then a file is created at /etc/asound.conf telling alsa which sound device to use. The problem I encountered was writing the asound.conf file from a udev script. Shouldn't be too hard to figure out once i get some more time. Remember I am creating a universal solution that will work on the majority of machines. If this solution is required just for YOUR machine it is much simpler. Just create two asound config files. One for the analog output and one for the HDMI output. When udev detects a HDMI plugin it creates a symlink at /etc/asound.conf pointing to the correct HDMI config file. If you need help with this just post the output of:

Code: Select all

xrandr && aplay -l
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
blue4meridian
Shogun
Shogun
Posts: 279
Joined: 29 Sep 2014, 05:58
Distribution: 64bit LxQt (Plastique/Mikachu)
Location: Jersey City N.J. USA

Re: Solved?:Static HDMI (...Out Of The Box Audio)

Post#38 by blue4meridian » 08 May 2015, 17:50

Salutations... :good:

The solution I refer to is universal. :wink: Because it is Google's solution to the problem.
"All" (as in "universal") Android devices are Plug n' Play. When there are quires and/or configuration... that is not Plug n' Play.
This solution is not for my device... it is the solution to the problem of Plug n' Play for ALL Porteus devices.

Best Regards... :beer:

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#39 by Tonio » 09 May 2015, 00:47

@brokenman
Would you mind posting the script? I ran your commands sugested I get

Code: Select all

guest@porteus:~$ xrandr && aplay -l
Screen 0: minimum 320 x 200, current 1920 x 1200, maximum 16384 x 16384
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 593mm x 371mm
   1920x1200      60.0*+
   1920x1080      60.0     59.9  
   1920x1080i     60.1     60.0  
   1680x1050      59.9  
   1400x1050      59.9  
   1280x1024      75.0     60.0  
   1440x900       59.9  
   1280x960       60.0  
   1152x864       75.0  
   1280x720       60.0     59.9  
   1024x768       75.1     70.1     60.0  
   1440x480       60.0     59.9  
   1440x480i      60.1     60.1  
   832x624        74.6  
   800x600        72.2     75.0     60.3     56.2  
   720x480        60.0     59.9  
   640x480        75.0     72.8     66.7     60.0     59.9  
   720x400        70.1  
DVI-0 disconnected (normal left inverted right x axis y axis)
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC887-VD Analog [ALC887-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC887-VD Digital [ALC887-VD Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
guest@porteus:~$ xrandr | awk '/ connected/{print$1}'
HDMI-0
guest@porteus:~$
I have checked the the aplay -l command also and contents of /etc/asound.conf I get

Code: Select all

.... /* removed to save space ********/ ........
state.HDMI {
	control {
	}
}
state.CX23885 {
	control {
	}
}
guest@porteus:~$ cat /etc/asound.conf
cat: /etc/asound.conf: No such file or directory
guest@porteus:~$ 

User avatar
brokenman
Site Admin
Site Admin
Posts: 5553
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#40 by brokenman » 11 May 2015, 15:57

Check if you have a config file at: $HOME/.asound.conf

If so move it elsewhere and run aplay -l again. The output should be something like:

Code: Select all

**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: 92HD99BXX Analog [92HD99BXX Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
How do i become super user?
Wear your underpants on the outside and put on a cape.

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#41 by Tonio » 12 May 2015, 23:09

File $HOME/.asound.conf appears to not be found :(

Code: Select all

guest@porteus:~$ cat $HOME/.asound.conf
cat: /home/guest/.asound.conf: No such file or directory
guest@porteus:~$ ls .as*
/bin/ls: cannot access .as*: No such file or directory
guest@porteus:~$ pwd
/home/guest
guest@porteus:~$ find -iname "*.conf" > .allconffiles
guest@porteus:~$ cat .allconffiles 
guest@porteus:~$ su -c 'find -iname "*.conf" > /home/guest/.allconffiles'
Password: 
find: `./.gvfs': Permission denied
guest@porteus:~$ cat .allconffiles 
guest@porteus:~$ su -c 'find -iname "*.conf" > /home/guest/.allconffiles'
Password: 
find: `./.gvfs': Permission denied
guest@porteus:~$
root@porteus:/etc# ls *.conf
ca-certificates.conf  gpm-syn.conf       mtools.conf    smartd.conf
changes-exit.conf     gpm-twiddler.conf  nfsmount.conf  syslog.conf
dhcpcd.conf           host.conf          nscd.conf      updatedb.conf
dnsmasq.conf          ld.so.conf         nsswitch.conf  usb_modeswitch.conf
esd.conf              logrotate.conf     resolv.conf    wpa_supplicant.conf
ffserver.conf         mdadm.conf         sensors3.conf
gpm-root.conf         mke2fs.conf        serial.conf
root@porteus:/etc# cd /root/
root@porteus:~# ls
Desktop/  Documents/  Downloads/  Music/  Pictures/  Video/
root@porteus:~# cat $HOME/.asound.conf
cat: /root/.asound.conf: No such file or directory
root@porteus:~# echo $HOME
/root
root@porteus:~# exit
logout
guest@porteus:~$ echo $HOME
/home/guest
guest@porteus:~$ ls .allconffiles 
.allconffiles
guest@porteus:~$ cat .allconffiles 
Looking at
http://www.maketecheasier.com/setup-hd ... in-linux/
I have done suggested command, and get

Code: Select all

guest@porteus:~$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=SB
    HDA ATI SB, ALC887-VD Analog
    Default Audio Device
sysdefault:CARD=SB
    HDA ATI SB, ALC887-VD Analog
    Default Audio Device
front:CARD=SB,DEV=0
    HDA ATI SB, ALC887-VD Analog
    Front speakers
surround21:CARD=SB,DEV=0
    HDA ATI SB, ALC887-VD Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=SB,DEV=0
    HDA ATI SB, ALC887-VD Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=SB,DEV=0
    HDA ATI SB, ALC887-VD Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SB,DEV=0
    HDA ATI SB, ALC887-VD Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SB,DEV=0
    HDA ATI SB, ALC887-VD Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SB,DEV=0
    HDA ATI SB, ALC887-VD Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=SB,DEV=0
    HDA ATI SB, ALC887-VD Digital
    IEC958 (S/PDIF) Digital Audio Output
guest@porteus:~$ 
EDIT*2 Created the suggested file .asoundrc with different values for hw 0,3, 0,2, etc and I get

Code: Select all

guest@porteus:~$ aplay -L
ALSA lib conf.c:1697:(snd_config_load1) _toplevel_:7:17:Unexpected char
ALSA lib conf.c:3417:(config_file_open) /home/guest/.asoundrc may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3339:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3788:(snd_config_update_r) hooks failed, removing configuration
guest@porteus:~$ rm .asoundrc 
So I removed it to get sound again. Thanks for your help and sorry for not reporting back earlier. :(

Code: Select all

root@porteus:~# lspci -vv | grep 'HDMI'
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
I also have a correction, the file /etc/asound.conf does not exist, the one that does is /etc/asound.state

Code: Select all

state.HDMI {
	control {
	}
}
state.CX23885 {
	control {
	}
}
root@porteus:~#
root@porteus:~# lspci -v | grep -i audio
00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
05:00.0 Multimedia video controller: Conexant Systems, Inc. CX23887/8 PCIe Broadcast Audio and Video Decoder with 3D Comb (rev 0f)
root@porteus:~# 

User avatar
brokenman
Site Admin
Site Admin
Posts: 5553
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#42 by brokenman » 14 May 2015, 01:23

I don't see any HDMI audio device in your output. Perhaps you need to try proprietary drivers for this card.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Tonio
Contributor
Contributor
Posts: 266
Joined: 28 Dec 2010, 16:37
Distribution: Slackware,porteus,FreeBSD,Slax
Location: 127.0.0.1

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#43 by Tonio » 14 May 2015, 02:07

If it does not appear, it is there:

Code: Select all

guest@porteus:~/Downloads$ su -c 'lspci -v | grep -i audio'
Password: 
00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
05:00.0 Multimedia video controller: Conexant Systems, Inc. CX23887/8 PCIe Broadcast Audio and Video Decoder with 3D Comb (rev 0f)
guest@porteus:~/Downloads$ su -c 'lspci -vv | grep 'HDMI' '
Password: 
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
guest@porteus:~/Downloads$ 
But the /etc/asound.state shows the same result and I loaded the boot parameter radeon.audio=1 and there is no sound from hdmi. I try the propietary driver(included in austrumi 3.1.7 and it has no sound either FYI). I have slackware64-current as of May 05 to install but have not done so yet. I like to run porteus without hardrive on this machine. I disconnected hard drive because if I leave it connected, it boots into windows 7 :( and does not give me a chance to boot cd/live usb. it has UEFI :(
Do not worry about it, but if you insist on fixing this, or finding a workaround, don't hesitate to post suggestions and I'll try them. Most of the solutions online are for *buntu and/or *buntu based distros which have pulseaudio installed. We don't want to work with that beast here, nor worry about a similar systemd stuff that may find its way :( :cry: over to Slackware which I hope never happens.

User avatar
blue4meridian
Shogun
Shogun
Posts: 279
Joined: 29 Sep 2014, 05:58
Distribution: 64bit LxQt (Plastique/Mikachu)
Location: Jersey City N.J. USA

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#44 by blue4meridian » 05 Aug 2015, 22:32

Salutations... :good:

@ brokenman... I "need help". :wall:
If this solution is required just for YOUR machine it is much simpler. Just create two asound config files. One for the analog output and one for the HDMI output. When udev detects a HDMI plugin it creates a symlink at /etc/asound.conf pointing to the correct HDMI config file. If you need help with this just post the output of:
guest@porteus:~$ xrandr && aplay -l
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
DVI-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 983mm x 576mm
1920x1080 60.0*+ 50.0 59.9 30.0 25.0 24.0 30.0 24.0
1920x1080i 60.1 50.0 60.0
1400x1050 60.0
1600x900 60.0
1280x1024 60.0
1280x960 60.0
1360x768 60.0
1280x720 60.0 50.0 59.9
1440x576i 50.1
1024x768 60.0 60.0
960x720 60.0
1440x480i 60.1 60.1
928x696 60.1
896x672 60.0
800x600 60.0 60.3 56.2
720x576 50.0
700x525 60.0
720x480 60.0 59.9
640x512 60.0
640x480 60.0 60.0 59.9
512x384 60.0
400x300 60.3 56.3
320x240 60.1
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC662 rev1 Digital [ALC662 rev1 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 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0

Best Regards... :beer:

User avatar
brokenman
Site Admin
Site Admin
Posts: 5553
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Universal HDMI Sound (...Plug n' Play 4 Porteus)

Post#45 by brokenman » 26 Sep 2015, 02:32

Help with what exactly?

If you are talking about getting sound over HDMI then this is what I can offer. Your /etc/asound.conf file should look like this for analog:
defaults.pcm.card 0
defaults.pcm.device 1
defaults.ctl.card 0


and this for HDMI
defaults.pcm.card 1
defaults.pcm.device 3
defaults.ctl.card 1


If the HDMI doesn't work then try replacing number 3 with 7
If this doesn't work I am out of ideas. Probably a driver for nVidia you need and don't have. Please try this in always fresh mode.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Post Reply