3

I recently upgraded my Pi 400 to the latest Os version that now uses Pulseaudio by default. I have my Pi connected to an AVR (Harman Kardon 151S) that is connected to a 5.1 setup of loudspeakers.

speaker-test -c6 -D hw:0 correctly plays sound from each loudspeaker including the subwoofer.

However, when I try to play a test file in Kodi, MPV or VLC, the surround channels are played trough the front loudspeakers and the subwoofer is silent.

I suspect this is because pulseaudio wrongly offers just a Digital Stereo output (a portion of pacmd list-cards):

 profiles:
            output:digital-stereo: Digital Stereo Output (priority 5100, available: unknown)
            off: Off (priority 0, available: unknown)

How can I make it use a 5.1 profile?

3 Answers 3

3

First, enable the correct number of speakers in daemon.conf (it's eiter in /etc/pulse/ or in ~/.config/pulse/). For 5.1 setup that would be:

default-sample-channels=6

Then load the channel mapper module from default.pa (again, it's eiter in /etc/pulse/ or in ~/.config/pulse/). For 5.1 setup that would be:

load-module module-combine channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
2
  • Hm, I just installed the latest release from January 28 2022 and I do get surround sound by default, just the mapping of the speakers is completely off! Any ideas how to fix that?
    – sup
    Mar 22 at 0:40
  • Actually, that one is fixed by setting [Mapping hdmi-surround] in /usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf to channel-map = front-left,front-right,lfe,front-center,rear-left,rear-right as per forums.raspberrypi.com/… In current release, surround works out of the box and the stops above are not needed. But I guess given how the original question is structured, this is the way to go, so I will accept it.
    – sup
    Mar 22 at 14:27
1

I am facing the same issue but got a little progress: with

pactl load-module module-alsa-sink name=HDMI device=hw:0,0 channels=6 tsched=0

there was coming sound from the right surround speaker instead of the front left (here is the reference). So now only the new module needs to be adjusted to play the correct channels. Thats's only a direction, when I find more about it I will share it.

3
  • That would be great! I am waiting for the new OS release for my next try!
    – sup
    Oct 4, 2021 at 16:16
  • Have you ever found more?
    – sup
    Mar 22 at 0:41
  • See my comment below to Dmitry Grigoryev answer - that shows how to fix the wrong placement of speakers.
    – sup
    Mar 22 at 14:28
1

So, here's the fix which allows you to even switch between Stereo and 5.1 at runtime, without touching the pulseaudio CLI.

Pulseaudio manages the input/output configuration through so-called profile set configuration files. More information on this is available upstream.

The thing is, the profile shipped with pulseaudio for the raspberry Pi HDMI output ... only contains stereo (as of bullseye).

[General]
auto-profiles = yes

[Mapping digital-stereo]
description = Digital Stereo
device-strings = hw:%f
fallback = yes
priority = 1
direction = output
channel-map = left,right
paths-output = hdmi-output-0

In order to be able to switch between stereo and 5.1, you can do the following:

  1. Place the following in a convenient location, I chose /etc/pulse/profile-sets/rpi-hdmi.conf (creating the directories):

    [General]
    auto-profiles = yes
    
    [Mapping digital-stereo]
    description = Digital Stereo
    device-strings = hw:%f
    priority = 1
    direction = output
    channel-map = left,right
    paths-output = hdmi-output-0
    
    [Mapping hdmi-surround]
    description = Digital Surround 5.1
    device-strings = hw:%f
    paths-output = hdmi-output-0
    channel-map = front-left,front-right,lfe,center,rear-left,rear-right
    priority = 3
    direction = output
    
  2. Disable udev in your /etc/pulse/default.pa by adding a # in front of the line load-module module-udev-detect.

  3. Load the sink manually by adding, to the bottom of the default.pa, the following:

    load-module module-alsa-card card_name=hdmi sink_name=alsa_output.hw_0_0 device_id=b1 tsched=false profile_set=/etc/pulse/profile-sets/rpi-hdmi.conf
    
  4. Restart pulseaudio or the entire Raspberry Pi

You should now be able to switch between modes in the configuration tab of the pavucontrol utility. If your Pi is running headless (without any screen), you can access the pulse server remotely using PULSE_SERVER=1.2.3.4 pavucontrol, where you need to substitute 1.2.3.4 with the IP address of your Raspberry Pi.

Make sure to adapt the path to your modified rpi-hdmi.conf if you put it in a different location.

This is tested to work on a Raspberry Pi 2B running latest Raspbian/Raspberry Pi OS Bullseye, connected to a Denon AVR-1910. I use a custom boot config because I have no TV attached and I also don't have the Denon online all the time, so the Pi may not detect it properly as HDMI sink:

dtparam=audio=on

hdmi_force_hotplug=1
hdmi_edid_file=1
hdmi_force_edid_audio=1
hdmi_group=1
hdmi_mode=5
hdmi_pixel_encoding=1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.