Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8013

Troubleshooting • Re: Do HDMI ports actually work on the Pi3 or Pi4?

$
0
0
Subject: Headless Plexamp on Raspberry Pi 4: No PCM Audio via HDMI with PulseAudio, IEC958_SUBFRAME_LE Limitation

Problem Overview:
I’m trying to configure a Raspberry Pi 4 (4GB) running Raspberry Pi OS Lite (Bookworm, 64-bit) to run Plexamp (v4.12.13) headlessly, outputting 5.1 PCM audio via HDMI 0 (hw:1,0, vc4-hdmi-0) to a standards-compliant A/V receiver. Initially, Plexamp output a 7.1 PCM signal with a silent center channel when using ALSA directly (selecting hw:1,0 in Plexamp’s web UI at http://<pi-ip>:32500). After installing PulseAudio to enable reliable PCM playback (based on reports of success), <code>speaker-test -c2 -D pulse</code> and <code>speaker-test -c6 -D pulse</code> produce silence, and Plexamp no longer plays any audio. The HDMI device only supports <code>IEC958_SUBFRAME_LE</code> (S/PDIF-like), not standard PCM formats (<code>S16_LE</code>, <code>S32_LE</code>), and PulseAudio’s user service crashes (<code>status=1/FAILURE</code>). I need help configuring PulseAudio or an alternative (e.g., PipeWire) to output PCM audio for Plexamp.</pi-ip>

Setup:

Hardware: Raspberry Pi 4 (4GB), HDMI 0 connected to A/V receiver (make/model: [please provide if known, e.g., Denon AVR-X2700H]).
OS: Raspberry Pi OS Lite (Bookworm, 64-bit, fully updated).
Software: Plexamp v4.12.13 (headless, systemd service), PulseAudio 16.1, ALSA.
Config:
/boot/firmware/config.txt: hdmi_drive=2, hdmi_force_hotplug=1, dtparam=audio=on, hdmi_force_edid_audio=1, hdmi_stream_channels=1.
raspi-config: Audio set to HDMI (nonint do_audio 1).
User pi in pulse and audio groups.
No /etc/asound.conf or ~/.asoundrc (removed to avoid conflicts).
Goal: Output 5.1 PCM audio (e.g., FLAC files) via HDMI for Plexamp, with all channels active.
Troubleshooting Steps and Findings:

Initial ALSA Setup:
Tested speaker-test -c2 -D default: Failed with ALSA lib pcm_params.c:2226:(snd1_pcm_hw_refine_slave) Slave PCM not usable.
Configured Plexamp to use hw:1,0 or vc4-hdmi-0: MAI PCM i2s-hifi-0 via web UI.
Result: Plexamp played 7.1 PCM with silent center channel; speaker-test -c2 -D hw:1,0 failed.
Diagnostic: aplay -D hw:1,0 --dump-hw-params /dev/zero showed hw:1,0 supports only IEC958_SUBFRAME_LE, 2–8 channels, 32kHz–192kHz, not PCM (S16_LE, S32_LE).
Learning: vc4-hdmi driver defaults to S/PDIF-like mode, incompatible with PCM needed by Plexamp.
ALSA Configuration Attempts:
Tried /etc/asound.conf with plug and plughw for hw:1,0 to convert PCM to IEC958_SUBFRAME_LE:
text

Collapse

Wrap

Copy
pcm.!default {
type plug
slave {
pcm "hw:1,0"
format S32_LE
rate 48000
channels 2
}
}
Result: speaker-test -c2 -D default still failed; Plexamp remained silent.
Removed configs to avoid conflicts.
Learning: Manual ALSA conversion insufficient; vc4-hdmi driver needs sound server mediation.
PulseAudio Installation:
Installed PulseAudio per community success (Reddit: Headless Plexamp with HDMI Audio):
text

Collapse

Wrap

Copy
sudo apt-get install -y pulseaudio pulseaudio-utils
Added pi to pulse group: sudo usermod -a -G pulse pi.
Result: PulseAudio service failed to start:
text

Collapse

Wrap

Copy
systemctl --user start pulseaudio
Job for pulseaudio.service failed because the control process exited with error code.
Status: Active: failed (Result: exit-code), code=exited, status=1/FAILURE, Start request repeated too quickly.
Logs: Failed to find a working profile, Failed to load module "module-alsa-card" (device_id="2"), ALSA driver bug: nothing to write.
Learning: PulseAudio crashes due to incorrect ALSA device (device_id="2" vs. card 1 for HDMI 0); possible Bookworm vc4-hdmi driver bug.
PulseAudio Troubleshooting:
Purged and reinstalled PulseAudio:
text

Collapse

Wrap

Copy
sudo apt-get purge --auto-remove pulseaudio
sudo apt-get install -y pulseaudio pulseaudio-utils
Reset configs: rm -rf ~/.config/pulse, sudo rm -rf /etc/pulse.
Tried manual start: pulseaudio --start --verbose, but service still failed.
Configured /etc/pulse/default.pa:
text

Collapse

Wrap

Copy
load-module module-udev-detect
load-module module-alsa-sink device=plughw:1,0 format=s16le channels=2 rate=48000
load-module module-native-protocol-unix
Set /etc/pulse/daemon.conf:
text

Collapse

Wrap

Copy
default-sample-format = s16le
default-sample-rate = 48000
default-sample-channels = 2
Tested: speaker-test -c2 -D pulse and paplay /usr/share/sounds/alsa/Front_Center.wav produced silence.
Learning: PulseAudio can’t initialize vc4-hdmi for PCM; service crash persists.
Logging Issues:
Attempted user journald: systemctl --user enable systemd-journald failed with Unit file systemd-journald.service does not exist.
System journald logs (sudo journalctl -u pulseaudio.service) unavailable or empty.
Learning: Bookworm Lite uses system journald; user journald not supported.
Current State:

PulseAudio service fails to start, producing no HDMI sinks for Plexamp.
speaker-test and Plexamp output silence.
aplay -l confirms card 1: vc4hdmi0 exists, but IEC958_SUBFRAME_LE limits PCM output.
Community reports (Reddit: Headless Plexamp) suggest PulseAudio should enable PCM, but service crashes prevent success.
Questions for the Forum:

How can I configure PulseAudio to output PCM (S16_LE or S32_LE) via hw:1,0 on Bookworm Lite, given the IEC958_SUBFRAME_LE limitation?
Is there a known Bookworm vc4-hdmi driver bug causing PulseAudio crashes or PCM issues? Should I downgrade to Bullseye?
Has anyone successfully run headless Plexamp with PCM audio via HDMI on Pi 4 with Bookworm Lite? What exact configs worked?
Would PipeWire (per Reddit: Plexamp with PipeWire) be a better alternative for PCM playback?
Any specific /boot/firmware/config.txt or ALSA settings to force PCM output?
Diagnostics Available:

aplay -l:
text

Collapse

Wrap

Copy
card 1: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
aplay -D hw:1,0 --dump-hw-params /dev/zero:
text

Collapse

Wrap

Copy
FORMAT: IEC958_SUBFRAME_LE
SAMPLE_BITS: 32
CHANNELS: [2 8]
RATE: [32000 192000]
PulseAudio logs (when available): module-alsa-card failure, ALSA driver bug.
Willing to provide further logs or test configs.




Objective
Run Plexamp Headless on a Raspberry Pi 4, outputting clean 5.1 multichannel PCM audio over HDMI via ALSA only—no PulseAudio, PipeWire, or JACK. Plexamp must output to either:
- The direct HDMI device (e.g., vc4-hdmi-0), or
- A properly defined ALSA plug device that passes through 5.1 channels correctly
“Default” ALSA output is not acceptable, as it upmixes to 7.1 and drops the center channel.

🧠 Current State
- OS: Raspberry Pi OS Bookworm, audio stack trimmed to ALSA-only
- Audio device present:
- card 1: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0
- card 2: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0
- aplay -D hw:1,0 plays through HDMI with stereo test tones
- Plexamp was previously working with "Default" output (though with bad channel mapping), but direct HDMI output has never produced sound
- After attempts to clean up the ALSA config and expose HDMI-only through ~/.asoundrc, Plexamp now segfaults at launch

⚠️ Known Problems & Discoveries
- ALSA plugins from /usr/share/alsa/alsa.conf (e.g. Speex, upmix, PulseAudio ghosts) began showing up in Plexamp's device list after .asoundrc edits and environment tweaks (ELECTRON_FORCE_ALSA, ALSA_CONFIG_PATH)
- Electron-based Plexamp fails to play anything via direct ALSA HDMI device (hw:1,0)—fails silently or instantly
- Using “Default” output plays, but upmixes incorrectly and drops the center channel (confirmed with AVR)
- Segfaults began after changes to systemd --user environment and ALSA sandboxing; likely due to misapplied or conflicting runtime config

❓ What I'm Asking
- Is there a proven, minimal .asoundrc config for Raspberry Pi that allows Electron/Chromium-based apps to output clean 5.1 PCM over HDMI via ALSA?
- Can I force Plexamp to use plughw:1,0 or a clean HDMI device with format negotiation, while avoiding exposure to irrelevant ALSA plugins?
- Why would ALSA’s “Default” output trigger 7.1 upmix with broken channel mapping, and how can I override that behavior to force correct 5.1 playback?
- Given that aplay works on hw:1,0, what likely causes Plexamp to crash when trying to use it? Faulty ALSA plugin dependency? Invalid environment?

🛠️ Troubleshooting Already Done
- Verified HDMI works via aplay and external players
- Created various .asoundrc configs using plug, hw, defaults.ctl.card, etc.
- Scoped ALSA_CONFIG_PATH and ELECTRON_FORCE_ALSA in service environment
- Cleaned up service and rebooted ALSA stack; no improvement
- Plexamp now fails at runtime with signal=SEGV, even with default .asoundrc

If anyone in this community has a Plexamp + ALSA + HDMI (multichannel) setup working on the Pi 4, please share a known-good .asoundrc or setup approach. I’m happy to test and provide logs as needed.

Statistics: Posted by ArmyOfQuad — Wed Jun 18, 2025 3:38 am



Viewing all articles
Browse latest Browse all 8013

Trending Articles