You are not logged in.

#1 2018-02-09 16:06:30

SpX91
Member
Registered: 2017-12-23
Posts: 34

Find the correct HDMI output sound

Hi,

I have multiple devices with same Arch Linux clone/install.

But....multiple devices with multiple aplay -l output for hdmi devices.

For example:

Intel Stick have 3 HDMI output but....only one sound works (0,2)
Intel NUC have 1 HDMI output ... (0,3)
Another brand name nuc have 1 HDMI output with ... (0,4)

So....how do to set the correct pulse audio default config :

load-module module-alsa-sink device=hw:x,x

(x,x is the card number with output number)

Thanks a lot,
Regards,

Offline

#2 2018-02-09 16:37:21

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Find the correct HDMI output sound

Don't do that, pulseaudio has autodetection, which should just work. Or if it doesn't set it on the existing HDMI sink, don't load a separate one with load-module module-alsa-sink there's no need to add that manually.

Offline

#3 2018-02-09 20:36:49

SpX91
Member
Registered: 2017-12-23
Posts: 34

Re: Find the correct HDMI output sound

V1del wrote:

Don't do that, pulseaudio has autodetection, which should just work. Or if it doesn't set it on the existing HDMI sink, don't load a separate one with load-module module-alsa-sink there's no need to add that manually.

This is my default pulse audio config:

#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore

### Automatically augment property information from .desktop files
### stored in /usr/share/application
load-module module-augment-properties

### Should be after module-*-restore but before module-*-detect
load-module module-switch-on-port-available

### Load audio drivers statically
### (it's probably better to not load these drivers manually, but instead
### use module-udev-detect -- see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
#load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
#load-module module-detect
.endif

### Automatically connect sink and source if JACK server is present
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif

### Automatically load driver modules for Bluetooth hardware
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif

.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP receiver module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP Multicast Sink'"
#load-module module-rtp-send source=rtp.monitor

### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Honour intended role device property
load-module module-intended-roles

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

### Enable positioned event sounds
load-module module-position-event-sounds

### Cork music/video streams when a phone stream is active
load-module module-role-cork

### Modules to allow autoloading of filters (such as echo cancellation)
### on demand. module-filter-heuristics tries to determine what filters
### make sense, and module-filter-apply does the heavy-lifting of
### loading modules and rerouting streams.
load-module module-filter-heuristics
load-module module-filter-apply

### Make some devices default
#set-default-sink output
#set-default-source input
load-module module-alsa-sink device=hw:0,2
load-module module-combine-sink sink_name=combined
set-default-sink combined

I need audio on Chromium and VLC same time.
The only solution is to use this.

You confirm if i remove lines :

load-module module-alsa-sink device=hw:0,2
load-module module-combine-sink sink_name=combined
set-default-sink combined

It autodetect and sound works ?

Last edited by SpX91 (2018-02-09 20:37:08)

Offline

#4 2018-02-10 12:53:12

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Find the correct HDMI output sound

It is very unlikely that that is necessary. Remove those last two lines and use pavucontrol to set up the correct fallback stream.

And please post output or config files in [ code ] and not [ quote ] tags.

Offline

#5 2018-02-12 14:47:39

SpX91
Member
Registered: 2017-12-23
Posts: 34

Re: Find the correct HDMI output sound

V1del wrote:

It is very unlikely that that is necessary. Remove those last two lines and use pavucontrol to set up the correct fallback stream.

And please post output or config files in [ code ] and not [ quote ] tags.

I dont have gui mode.
I'm only on cli.

So for pavucontrol is not correct ?

Thanks

Offline

#6 2018-02-12 16:40:42

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Find the correct HDMI output sound

It's relatively cumbersome to make this general purpose scriptable, it depends on the cards you have. You if you have a separate HDMI card use

pactl list sinks short

to get the HDMI sink. If you use the name you get from that you can set that one to be your default sink with

pacmd set-default-sink $NAME or $INDEXNR

Using sink-combined is a hack, and will give you suboptimal configuration with regards to sample rate and possibilities being used. If you properly use a HDMI sink detected by pulseaudio, you can configure that to   enable direct passthrough of certain audio formats and your applications will open the sink with the correct sample rates as opposed to using a  combined sink.

If you still want to go with the manual ALSA device, despite it not being the best solution, one thing you can check is

/proc/asound/cardX/eldX.Y

for a mention that a monitor is connected and then count from the Y part upwards mapping it to the corresponding pcmZp device. e.g.

ls /proc/asound/card1
codec#0  eld#0.0  eld#0.1  eld#0.2  eld#0.3  id  pcm3p  pcm7p  pcm8p  pcm9p

cat /proc/asound/card1/eld#0.1
   monitor_present         1
   ...

#Hence pcm7p is the correct device --> hw:1,7 is our output

Last edited by V1del (2018-02-12 17:00:27)

Offline

#7 2018-02-12 18:42:38

SpX91
Member
Registered: 2017-12-23
Posts: 34

Re: Find the correct HDMI output sound

Thanks,

I try this soon smile

Offline

#8 2018-02-12 19:06:42

SpX91
Member
Registered: 2017-12-23
Posts: 34

Re: Find the correct HDMI output sound

V1del wrote:

It's relatively cumbersome to make this general purpose scriptable, it depends on the cards you have. You if you have a separate HDMI card use

pactl list sinks short

to get the HDMI sink. If you use the name you get from that you can set that one to be your default sink with

pacmd set-default-sink $NAME or $INDEXNR

Using sink-combined is a hack, and will give you suboptimal configuration with regards to sample rate and possibilities being used. If you properly use a HDMI sink detected by pulseaudio, you can configure that to   enable direct passthrough of certain audio formats and your applications will open the sink with the correct sample rates as opposed to using a  combined sink.

If you still want to go with the manual ALSA device, despite it not being the best solution, one thing you can check is

/proc/asound/cardX/eldX.Y

for a mention that a monitor is connected and then count from the Y part upwards mapping it to the corresponding pcmZp device. e.g.

ls /proc/asound/card1
codec#0  eld#0.0  eld#0.1  eld#0.2  eld#0.3  id  pcm3p  pcm7p  pcm8p  pcm9p

cat /proc/asound/card1/eld#0.1
   monitor_present         1
   ...

#Hence pcm7p is the correct device --> hw:1,7 is our output

I have this line :

load-module module-alsa-sink device=hw:0,2
load-module module-combine-sink sink_name=combined
set-default-sink combined

You say remove two last...but the first one is only for hw 0,2, i need to remove it also ?

Offline

#9 2018-02-12 19:22:49

SpX91
Member
Registered: 2017-12-23
Posts: 34

Re: Find the correct HDMI output sound

I have only this thing :

> $ cat /proc/asound/card0/pcm0p/info /proc/asound/card0/pcm1p/info /proc/asound/card0/pcm2p/info

card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: HdmiLpeAudio
name: Intel HDMI/DP LPE Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
card: 0
device: 1
subdevice: 0
stream: PLAYBACK
id: HdmiLpeAudio
name: Intel HDMI/DP LPE Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
card: 0
device: 2
subdevice: 0
stream: PLAYBACK
id: HdmiLpeAudio
name: Intel HDMI/DP LPE Audio
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1

The last is the correct sound output....

Offline

#10 2018-02-13 18:40:46

SpX91
Member
Registered: 2017-12-23
Posts: 34

Re: Find the correct HDMI output sound

I need help for this thing...is important for me sad

I dont find the correct CARD connected to the monitor.

Last edited by SpX91 (2018-02-15 14:47:11)

Offline

#11 2018-02-20 14:30:18

SpX91
Member
Registered: 2017-12-23
Posts: 34

Re: Find the correct HDMI output sound

Hi,

Nobody have issue for help me to find the correct hw ?

On Intel Stick is hw 0,2
But on Intel NUC is hw 0,3

You say pulseaudio is able to configure automaticly and find the good sound output, but i have try to restore default config and not working,

Any helps is very apreciate.

Regards,

Offline

#12 2018-02-20 15:24:50

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,739

Re: Find the correct HDMI output sound

SpX91 -- that is five posts in a row.  Please use the edit function rather than creating more posts.
Thanks.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#13 2018-02-20 16:26:15

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Find the correct HDMI output sound

I just checked on my intel HDMI system, and it doesn't look like it exposes that information like nvidia's driver does indeed. That being the case I don't see how you'd be able to automate this.

Can you post a

pacmd list-cards

from an affected system (with the relevant HDMI output connected and active)?

You might also want to elaborate on your requirements, why do you have to be able to detect this automatically? Want prevents you, to make that switch during configuration?

Offline

#14 2018-02-20 19:36:52

SpX91
Member
Registered: 2017-12-23
Posts: 34

Re: Find the correct HDMI output sound

V1del wrote:

I just checked on my intel HDMI system, and it doesn't look like it exposes that information like nvidia's driver does indeed. That being the case I don't see how you'd be able to automate this.

Can you post a

pacmd list-cards

from an affected system (with the relevant HDMI output connected and active)?

You might also want to elaborate on your requirements, why do you have to be able to detect this automatically? Want prevents you, to make that switch during configuration?

Thanks,

So, my requierements is to be able to detect the correct sound card output, because when i deploy my system by ISO , i have multiple script to configure it.
But the sound doesn't work automaticly.

% pacmd list-cards

> $ pacmd list-cards
0 card(s) available.

% pacmd list-sinks

> $ pacmd list-sinks
3 sink(s) available.
  * index: 0
        name: <combined>
        driver: <module-combine-sink.c>
        flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: RUNNING
        suspend cause:
        priority: 1000
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        base volume: 65536 / 100% / 0.00 dB
        volume steps: 65537
        muted: no
        current latency: 20.77 ms
        max request: 4 KiB
        max rewind: 0 KiB
        monitor source: 0
        sample spec: s16le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        used by: 2
        linked by: 2
        configured latency: 23.22 ms; range is 0.50 .. 200.00 ms
        module: 12
        properties:
                device.class = "filter"
                device.description = "Simultaneous output to Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCI Configuration Registers"
                device.icon_name = "audio-card"
    index: 1
        name: <alsa_output.hw_0_2>
        driver: <module-alsa-sink.c>
        flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: RUNNING
        suspend cause:
        priority: 9030
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        base volume: 65536 / 100% / 0.00 dB
        volume steps: 65537
        muted: no
        current latency: 19.89 ms
        max request: 4 KiB
        max rewind: 344 KiB
        monitor source: 1
        sample spec: s16le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        used by: 1
        linked by: 1
        configured latency: 23.22 ms; range is 0.50 .. 2000.18 ms
        module: 24
        properties:
                alsa.resolution_bits = "16"
                device.api = "alsa"
                device.class = "sound"
                alsa.class = "generic"
                alsa.subclass = "generic-mix"
                alsa.name = "Intel HDMI/DP LPE Audio"
                alsa.id = "HdmiLpeAudio"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "2"
                alsa.card = "0"
                alsa.card_name = "Intel HDMI/DP LPE Audio"
                alsa.long_card_name = "Intel HDMI/DP LPE Audio"
                alsa.driver_name = "snd_hdmi_lpe_audio"
                device.bus_path = "pci-0000:00:02.0-platform-hdmi-lpe-audio"
                sysfs.path = "/devices/pci0000:00/0000:00:02.0/hdmi-lpe-audio/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "22b0"
                device.product.name = "Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCI Configuration Registers"
                device.string = "hw:0,2"
                device.buffering.buffer_size = "352832"
                device.buffering.fragment_size = "352832"
                device.access_mode = "mmap+timer"
                device.description = "Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCI Configuration Registers"
                device.icon_name = "audio-card-pci"
    index: 2
        name: <combined.2>
        driver: <module-combine-sink.c>
        flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
        state: SUSPENDED
        suspend cause: IDLE
        priority: 1000
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        base volume: 65536 / 100% / 0.00 dB
        volume steps: 65537
        muted: no
        current latency: 0.00 ms
        max request: 34 KiB
        max rewind: 0 KiB
        monitor source: 2
        sample spec: s16le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        used by: 0
        linked by: 0
        configured latency: 0.00 ms; range is 0.50 .. 200.00 ms
        module: 25
        properties:
                device.class = "filter"
                device.description = "Simultaneous output to Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCI Configuration Registers"
                device.icon_name = "audio-card"

%pacmd list-sink-inputs

> $ pacmd list-sink-inputs
3 sink input(s) available.
    index: 0
        driver: <module-combine-sink.c>
        flags: VARIABLE_RATE DONT_MOVE NO_CREATE_SUSPEND
        state: RUNNING
        sink: 1 <alsa_output.hw_0_2>
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 0.00 ms
        requested latency: 23.22 ms
        sample spec: s16le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        resample method: trivial
        module: 12
        properties:
                media.name = "Simultaneous output on Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series PCI Configuration Registers"
                media.role = "filter"
                module-stream-restore.id = "sink-input-by-media-role:filter"
    index: 12
        driver: <protocol-native.c>
        flags: START_CORKED
        state: RUNNING
        sink: 0 <combined>
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 72.56 ms
        requested latency: 23.22 ms
        sample spec: float32le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        resample method: copy
        module: 9
        client: 22 <Chromium>
        properties:
                application.icon_name = "chromium-browser"
                media.name = "Playback"
                application.name = "Chromium"
                native-protocol.peer = "UNIX socket client"
                native-protocol.version = "32"
                application.process.id = "7709"
                application.process.user = "client"
                application.process.host = "s263"
                application.process.binary = "chromium"
                application.language = "en_US.UTF-8"
                window.x11.display = ":0.0"
                application.process.machine_id = "00c42a172ab34ce9941fc6cd9e86b7fe"
                module-stream-restore.id = "sink-input-by-application-name:Chromium"
    index: 161
        driver: <protocol-native.c>
        flags: START_CORKED FIX_RATE
        state: RUNNING
        sink: 0 <combined>
        volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        muted: no
        current latency: 392.47 ms
        requested latency: 40.00 ms
        sample spec: float32le 2ch 44100Hz
        channel map: front-left,front-right
                     Stereo
        resample method: copy
        module: 9
        client: 21 <VLC media player (LibVLC 2.2.8)>
        properties:
                media.role = "video"
                media.name = "audio stream"
                application.name = "VLC media player (LibVLC 2.2.8)"
                native-protocol.peer = "UNIX socket client"
                native-protocol.version = "32"
                application.id = "org.VideoLAN.VLC"
                application.version = "2.2.8"
                application.icon_name = "vlc"
                application.language = "en_US.UTF-8"
                application.process.id = "7971"
                application.process.user = "client"
                application.process.host = "s263"
                application.process.binary = "vlc"
                window.x11.display = ":0.0"
                application.process.machine_id = "00c42a172ab34ce9941fc6cd9e86b7fe"
                module-stream-restore.id = "sink-input-by-media-role:video"

I repeat, i have INTEL STICK and INTEL NUC

INTEL STICK doesn't have output, i use HDMI to output the sound to the TV or SCREEN with speaker.

INTEL NUC have ouput (MIC / HEADSEAT) but i use also HDMI to output the sound

Offline

#15 2018-02-22 11:47:17

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Find the correct HDMI output sound

Repost those outputs without your modifications (and reenable the module-udev-detect line) as we can't see what pulse is detecting in this case. Also I recently read something mentioning that the exact HDMI connected state might be under another path, I don't remember where right now, but will double check on my system.

P.S. Even if we have to resort to manually loading the correct device,

load-module module-alsa-sink device=hw:0,2
set-default alsa_output.hw_0_2

is a much better compromise in regard to performance and properly applying sample rate conversions than letting it go over a combined sink without having a usecase or reason to go over a combined sink.

Edit: I just checked on my system and it works the same way on my intel card:

ls  /proc/asound/card0/
codec#0  codec#2  eld#2.0  eld#2.1  eld#2.2  eld#2.3  eld#2.4  eld#2.5  eld#2.6  eld#2.7  eld#2.8  id  pcm0c  pcm0p  pcm10p  pcm3p  pcm7p  pcm8p  pcm9p

Is that not the case on your system? It's a bit weird how the mapping works, but in this case it'd be

eld#2.0 --> pcm3p --> hw:0,3
eld#2.1 --> pcm7p --> hw:0,7
...

Last edited by V1del (2018-02-26 14:23:07)

Offline

Board footer

Powered by FluxBB