Talk:PulseAudio/Examples

From ArchWiki

Can't udev rule directly run a script?

PulseAudio/Examples#Automatically switch audio to HDMI states that

Note: udev rule can't directly run a script, a workaround is to use a .service to run this script

Aren't there some examples for scripts in udev? Regid (talk) 18:53, 17 July 2017 (UTC)Reply[reply]

The warning in Udev#Writing_udev_rules mentions that udev can't run long-running tasks. Otherwise, it doesn't matter what it runs. -- Lahwaacz (talk) 19:25, 29 July 2017 (UTC)Reply[reply]
But this is not really a long running task, so why not directly call it with "/bin/bash /usr/local/bin/hdmi_sound_toggle.sh" -- Blomblom (talk) 07:18, 25 May 2018 (UTC)Reply[reply]
You can call it with /usr/local/bin/hdmi_sound_toggle.sh directly, the problem here is that PATH is empty, it should be set to /usr/bin or give /usr/bin/pactl explicitly —This unsigned comment is by Immae (talk) 07:54, 16 March 2019‎. Please sign your posts with ~~~~!

Binaural Stereo plugin cannot downmix surround

I have looked at the source code to the ladspa plugin, and as per the design and even the name of the Bauer Stereo to Binaural filter, it is only capable of processing stereo signals into binaural headphone audio. It does not support any special case for downmixing surround signals. It does, however, attempt to reduce the effect of stereo audio sounding like it's "inside your head".

As an extra or alternative, may I suggest a section that describes how to configure the `virtual-surround-sink` module? It is capable of downmixing 5.1 surround or even more to binaural stereo. There are publicly available HRIR sets that can be selected from, which support 5.1 to stereo downmixing either using a dummy head, or using a selection of real heads. Theoretically, it could support a larger downmix set than 5.1, but that would require more left/right pairs to be included in the impulse, and each channel added to the impulse adds extra processing time to the filter. 5.1 is probably more than sufficient for most cases. Kode54 (talk) 09:18, 31 May 2019 (UTC)Reply[reply]

Monitor specific output

The example tells you to use a module-null-sink, this has the effect that only the monitor can listen to the sound sent there. For my usecase I wanted to be able to hear the sound myself as well, for that you can use a module-remap-sink, maybe that that could be added to the section.

—This unsigned comment is by JJK (talk) 06:38, 12 April 2020‎. Please sign your posts with ~~~~!

Mixing additional audio into the microphone's audio

About

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: Complex scripts don't belong to the wiki. (Discuss in Talk:PulseAudio/Examples)
True, and I did spare this some thought, but decided to post the script anyway, the reasons being
  • I could not come up with a better idea
  • The script is a non-conditional, non-looped sequence of 10 commands, the first two of which are variable assignments. That is not quite what one would call "complex"; there is just a lot of documentation
What would be the proper way to handle this?
Eomanis (talk) 14:24, 12 April 2020 (UTC)Reply[reply]
Post the script somewhere else, e.g. on Github, and add a link instead. -- Lahwaacz (talk) 14:54, 12 April 2020 (UTC)Reply[reply]
I have a GitHub account but haven't posted anything there yet. Until I figure out how that works I re-wrote the chapter to get rid of the huge script. -- Eomanis (talk) 16:54, 12 April 2020 (UTC)Reply[reply]
That's actually even better, it can stay like this. -- Lahwaacz (talk) 17:25, 12 April 2020 (UTC)Reply[reply]

Having both speakers and headphones plugged in and switching in software on-the-fly

Recent changes to pulse audio packages mean that this section is now out of date. For example, this update to Manjaro, led to this functionality no longer working for me (though it may have happened in a previous update).

This is largely due to the fact that the files in /usr/share/pulseaudio/alsa-mixer/paths were moved to /usr/share/alsa-card-profile/mixer/paths, but also to changes in the files themselves. The package alsa-card-profiles caused this change.

Upon updating, I was no longer having audio through just my Headphones. I could get the lineout to output by itself while muting my headphones, but the reverse was not true. I could not get just my headphones to output audio (in this case the lineout was also outputting audio).

I spent some time looking through the new files in /usr/share/alsa-card-profile/mixer/paths and the good news, is that having speakers and headphones plugged, and switching on the fly is actually easier now. Simply edit /usr/share/alsa-card-profile/mixer/paths/analog-output-headphones.conf, and make sure that you have the following:

[Element Front]
switch = off
volume = off

in the [Element Front] section.

I am adding this to get thoughts on how/if? we should update the documentation to reflect this. I welcome your suggestions.

Smendez (talk) 16:20, 5 November 2020 (UTC)Reply[reply]

Note that Manjaro packages are irrelevant on this wiki - only Arch is supported here. See Code of conduct#Arch Linux distribution support ONLY. -- Lahwaacz (talk) 11:47, 7 November 2020 (UTC)Reply[reply]
The package I referenced: alsa-card-profiles is an arch package. -- Smendez (talk) 17:49, 7 November 2020 (UTC)Reply[reply]
this process solved the exact issue i was having as well. i found an upstream bug referencing the same: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/256#note_13393 i believe the real solution would be to get a custom profile for our sound card submitted upstream. my vendor/model numbers from udevadm info -qall -p /sys/class/sound/card0 show 0x8086 and 0x1c20 respectively. upstream documentation link: https://www.freedesktop.org/wiki/Software/PulseAudio/Backends/ALSA/Profiles/ -- Jsermer (talk) 19:18, 25 November 2020 (UTC)Reply[reply]

I am following up to document that once again, this procedure has changed in light of this recent update to the: pulse-audio package

After this most recent change, the file to edit is back to being in /usr/share/pulseaudio/alsa-mixer/paths. The suggestion above still works, but depending on which version of the pulse-audio package you are using, you need to be aware of the different directories that will apply. Smendez (talk) 00:42, 11 February 2021 (UTC)Reply[reply]

Files to edit for PulseAudio have always been in /usr/share/pulseaudio/alsa-mixer/paths. Files in /usr/share/alsa-card-profile/mixer/paths are provided by alsa-card-profiles that is required by pipewire-audio. Both packages cite Upstream URL: https://pipewire.org
Files in /usr/share/alsa-card-profile/mixer/paths are identical to /usr/share/pulseaudio/alsa-mixer/paths including comments that files are part of PulseAudio. Files provided by alsa-card-profiles should be edited to reflect that they are provided by and for PipeWire
Nik.gnomic (talk) 09:02, 10 April 2023 (UTC)Reply[reply]

Suggest PipeWire as PulseAudio through JACK alternative

PipeWire can replace both PulseAudio and JACK and provide nearly configuration free experience of them both intertwined, with no overhead of running two audio servers at once. I think it's something worth mentioning in that section. Architector4 (talk) 09:02, 31 December 2020 (UTC)Reply[reply]

Structure

I think we need to make this page less of a mess. For this we should:

1. Check what is still valid and delete stuff.

2. Restructure this, for better overview.

My suggested structure would be:

  • Input and Output (or "Set Input and Output"): could include point 1 to 4 or 6, 9 & 10
  • Pulseaudio over network
  • Surround sound systems
  • Pulseaudio with Jack, OSS, Alsa and Pipewire: could include point 11, 13 & 19
  • Pulseaudio in chroot
  • Remapping: could include 15, 16, 17

and so on.

Also: Move point 12 to troubleshooting.

G3ro (talk) 14:04, 14 March 2021 (UTC)Reply[reply]

We should also remember to merge PulseAudio#Tips and tricks to this page. -- Lahwaacz (talk) 19:05, 20 March 2021 (UTC)Reply[reply]
I suggest generalizing the section "PulseAudio over network" to include a subsection with the multi-user setup via UNIX sockets. It doesn't really belong anywhere else. Maybe the section could be renamed "TCP and UNIX Sockets"? --Xyne (talk) 01:33, 9 September 2021 (UTC)Reply[reply]