Set proper audio device names on Raspberry pi 4

This may need a bit of adjustment for kms users, as vc4 becomes the sound driver which switches to digital audio and has different device names. But I like the names, so I hope it works out.

Edit:
When using kms, the sink name changes to:
alsa_output.platform-fef00700.hdmi.iec958-stereo

If you run:

$ pacmd 'update-sink-proplist alsa_output.platform-fef00700.hdmi.iec958-stereo device.description="HDMI"'

It does set the description to: device.description = "HDMI"
However, the Plasma widget does not reflect that setting, it continues to be called:
Digital Output (S/PDIF)

When using fkms, the widget does change to reflect the setting using the bcm2835 sink.

Edit 2:
This same behavior occurs with Plasma on both Raspberry Pi OS and Arch.

Edit 3:
When using kms
$ pacmd list-sinks

        ports:
                iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)

So I assume this is what the widget uses for a description.

Edit 4:
The S/PDIF is the headphone jack, yet the sink is hdmi. The widget only has the S/PDIF output device. Yet my actual audio-out is hdmi, no headphone output. A bit wonky.

With fkms, the widget has both a hdmi and a headphone analog audio-out.

Edit 5:
If you manage to get both Headphones and Digitial Output with kms working, the following works:

pacmd 'update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback device.description="Analog"'
pacmd 'update-sink-proplist alsa_output.platform-fef00700.hdmi.iec958-stereo device.description="HDMI"'

What would be the consequences for those who have an audio hat, as hifiberry ?

One solution does not work for all RPI4’s. I used the pacmd utility to come up with these commands I added to $HOME/.bashrc, after which meaningful device descriptions are given for pulseaudio UI"s.

pacmd 'update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback device.description=“bcm2835 HDMI 1” ’
pacmd 'update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback.2 device.description=“bcm2835 HDMI 2” ’
pacmd 'update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback.3 device.description=“bcm2835 Headphones” ’

I chose to use the alsa.name/alsa.id/also.card_name/alsa.long_card_name value for the device.description value. Perhaps a better solution would be to make the changes in /etc/pulse/default.pa, but I don’t have the know-how to do that. I like the suggestion by @Strit to handle this in the ARM image.

update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback device.description='bcm2835 HDMI 1'
update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback.2 device.description='bcm2835 HDMI 2'
update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback.3 device.description='bcm2835 Headphones'

Just as you suggested, append that to the end of /etc/pulse/default.pa

1 Like

That was my original idea but it kept messing up pulse audio so for now I just made a script to do it the way I did it. :slight_smile:

I gave your method a try. Like @gameslayer9999, it did not work for me. When the change for device.description is done via /etc/pulse/default.pa the pulseaudio UI on the task bar is inactive (grayed out).

Edit: The method works after revision as noted in following posts.

@gameslayer9999 @dbeach
I have pulseaudio 14.2-3 installed on Manjaro and modifying the default.pa file works for me. However, when I test it on Raspi OS with 14.2-2 installed, pulseaudio fails. However, I can successfully modify the running config with the pacmd command. Maybe a bug in pulseaudio?

Edit:
On startup on RaspiOS it fails with: No sink found by this name or index.
However, if I restart pulseaudio, it starts properly. Not sure why yet, but it can work.

I am using pulseaudio 14.2-3, that’s not a factor for me. I reinstated your method and checked the journal. The logged problems are “Failed to parse proplist” followed by “Failed to initialize daemon due to errors while executing startup commands. Source of commands: /etc/pulse/default.pa”. The command syntax problem is discussed in this post:

update-sink-proplist does not work when setting a description containing spaces

Replacing the quotes with apostrophes when defining the device.description values solves the problem. (Using escaped quotes within quotes or apostrophes within quotes does not work.) A less graceful solution is to remove or replace spaces in the value which will allow use of quotes.

It’s not a bug, it’s a “feature”!

1 Like

Sounds like using an underscore instead of a whitespace would solved it?

I did not try that, but the referenced post says it works. But then again the posts says escaped quotes works, but it does not.

I’ll have to try again but this should be defiantly needs to be implemented into the default pulse conf so they are properly named :slight_smile:

Good find. I corrected my post above by switching it to apostrophes. I ran across that parsing error while running the pacmd command, and had edited that post.

Adding this to the bottom of my default.pa file broke my audio also you don’t need hdmi2 as audio only comes from one of them which is the hdmi mini port on the inside.

Use the pacmd utility to see what your actual configuration is, then adjust the lines added to default.pa to work with your configuration. As noted in my earlier post, different machines may need different modifications.

>>> list-cards
2 card(s) available.
    index: 0
	name: <alsa_card.platform-bcm2835_audio>
	driver: <module-alsa-card.c>
	owner module: 6
	properties:
		alsa.card = "0"
		alsa.card_name = "bcm2835 HDMI 1"
		alsa.long_card_name = "bcm2835 HDMI 1"
		alsa.driver_name = "snd_bcm2835"
		device.bus_path = "platform-bcm2835_audio"
		sysfs.path = "/devices/platform/soc/fe00b840.mailbox/bcm2835_audio/sound/card0"
		device.form_factor = "internal"
		device.string = "0"
		device.description = "Built-in Audio"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card"
	profiles:
		output:stereo-fallback: Stereo Output (priority 5100, available: unknown)
		output:mono-fallback: Mono Output (priority 100, available: unknown)
		output:multichannel-output: Multichannel Output (priority 100, available: unknown)
		off: Off (priority 0, available: unknown)
	active profile: <output:stereo-fallback>
	sinks:
		alsa_output.platform-bcm2835_audio.stereo-fallback/#0: HDMI
	sources:
		alsa_output.platform-bcm2835_audio.stereo-fallback.monitor/#0: Monitor of Built-in Audio Stereo
	ports:
		analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
			properties:
				
    index: 1
	name: <alsa_card.platform-bcm2835_audio.2>
	driver: <module-alsa-card.c>
	owner module: 7
	properties:
		alsa.card = "1"
		alsa.card_name = "bcm2835 Headphones"
		alsa.long_card_name = "bcm2835 Headphones"
		alsa.driver_name = "snd_bcm2835"
		device.bus_path = "platform-bcm2835_audio"
		sysfs.path = "/devices/platform/soc/fe00b840.mailbox/bcm2835_audio/sound/card1"
		device.form_factor = "internal"
		device.string = "1"
		device.description = "Built-in Audio"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card"
	profiles:
		output:stereo-fallback: Stereo Output (priority 5100, available: unknown)
		output:mono-fallback: Mono Output (priority 100, available: unknown)
		output:multichannel-output: Multichannel Output (priority 100, available: unknown)
		off: Off (priority 0, available: unknown)
	active profile: <output:stereo-fallback>
	sinks:
		alsa_output.platform-bcm2835_audio.stereo-fallback.2/#1: Headphones
	sources:
		alsa_output.platform-bcm2835_audio.stereo-fallback.2.monitor/#1: Monitor of Built-in Audio Stereo
	ports:
		analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: unknown)
			properties:
				device.icon_name = "audio-headphones"

And yes that is true, that sort of configuration for different hardware could be done for the specific images/hardware images :slight_smile:

I appear to have the same sound problems with the Raspberry pi.4.0.0. Having no sound at all via the new Pi Hut Speaker. Has anyone here ever resolved this on going issue ?

I am not aware of an on going issue. You have not given any info on how the speaker connects. If it connect via bluetooth you have to connect with the bluman applet first on the taskbar then choose it in the Sound Settings on the taskbar.

1 Like

As noted above in this thread, the ongoing issue is the default sound output options for Sound Settings are garbage. On my kit that is corrected with these lines added to /etc/pulse/default.pa:

### Set meaningful output device descriptions for UI
update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback device.description='bcm2835 HDMI 1'
update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback.2 device.description='bcm2835 HDMI 2'
update-sink-proplist alsa_output.platform-bcm2835_audio.stereo-fallback.3 device.description='bcm2835 Headphones'

Also as noted above, the pacmd utility should be used to determine what entries are appropriate for a particular machine.

You posted above as “Having no sound at all via the new Pi Hut Speaker”. I could only assume your speakers had no sound output at all using the Pi Hut Speaker.

This thread was about proper names not showing up as opposed to I guess you could call generic names with some DE’s in it’s “Sound Settings”. They would show up with the right names in “Pulse Audio Settings” but all sound devices worked when clicked on the generic names in the DE’s “Sound Settings”.

This idea in this thread had issues for a global config when tested with multiple DE’s and switching back and forth with kms/fkms/kde (plasma/x11) and there is now way to configure any third party addon sound devices people may have.