Unable to force sound to headphone jack RPI 4

Having issues with your DietPi installation, or, found a bug? Post it here.
gofireworks
Posts: 7
Joined: Wed Jul 29, 2020 3:17 am

Unable to force sound to headphone jack RPI 4

Post by gofireworks »

Hello, I have a raspberry pi 4 running the latest version of DietPi (v6.31.2). I have it plugged in to my TV through an HDMI cord, and to my speakers through the 3.5mm jack. I would like to force the audio through 3.5mm so that I am able to use shairport-sync and play audio without having to turn on the TV, but I am unable to do so. I have set the audio to force 3.5mm through the use of dietpi-config > audio options > sound card > rip-bcm2835-3.5mm (also see image below), but no sound comes through until I turn on the TV. Is this an issue with shairport-sync that I need to configure, or something else?

I appreciate any help!

Screen Shot 2020-07-28 at 8.22.57 PM.png
User avatar
MichaIng
Site Admin
Posts: 2488
Joined: Sat Nov 18, 2017 6:21 pm

Re: Unable to force sound to headphone jack RPI 4

Post by MichaIng »

Many thanks for your report.

Did you reboot one time after applying the sound card selection?

Can you paste the output of amixer -c 0 contents (in case after reboot if 3.5mm output still does not work).

And in case try to add hdmi_drive=1 to /boot/config.txt and reboot another time. This forces DVI mode which disables HDMI sound from the other side.
gofireworks
Posts: 7
Joined: Wed Jul 29, 2020 3:17 am

Re: Unable to force sound to headphone jack RPI 4

Post by gofireworks »

I did not reboot, but after doing so I have not been able to force 3.5mm. I've added the hdmi_drive=1 line, reboot, and I actually lose all sound coming from the Pi, even when the TV is on.

The contents of amixer -c 0 contents are as follows:

Code: Select all

numid=2,iface=MIXER,name='HDMI Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
numid=1,iface=MIXER,name='HDMI Playback Volume'
  ; type=INTEGER,access=rw---R--,values=1,min=-10239,max=400,step=0
  : values=2
  | dBscale-min=-102.39dB,step=0.01dB,mute=1
User avatar
MichaIng
Site Admin
Posts: 2488
Joined: Sat Nov 18, 2017 6:21 pm

Re: Unable to force sound to headphone jack RPI 4

Post by MichaIng »

Strange. hdmi_drive=1 disables HDMI sound the other way, so it makes sense that you loose all sound then.

What is strange is that numid=2 is not shown in your amixer output as this is what usually switches between 3.5mm, HDMI and auto: https://www.raspberrypi.org/documentati ... -config.md

If you again comment/remove the hdmi_drive line, does amixer -c 0 contents still only show those two switches?

And just to assure: dtparam=audio=on is set in config.txt, right?
gofireworks
Posts: 7
Joined: Wed Jul 29, 2020 3:17 am

Re: Unable to force sound to headphone jack RPI 4

Post by gofireworks »

Yes, I get the same results from amixer after uncommenting the hdmi_drive line

The portion in config.txt is also set to on, as well: dtparam=audio=on
User avatar
MichaIng
Site Admin
Posts: 2488
Joined: Sat Nov 18, 2017 6:21 pm

Re: Unable to force sound to headphone jack RPI 4

Post by MichaIng »

Hmm, probably this needs to be configured differently on RPi4 (although never heard of an 3.5mm issue) or hardware issue?
Btw you can follow any Raspbian/Raspberry Pi OS instructions you find.

Just checked raspi-config and they do the same: https://github.com/RPi-Distro/raspi-con ... 1724-L1737

Ah did we already check if onboard audio is really card 0 or if something else occupied that ID? Please paste the output of:
aplay -l
aplay -L
gofireworks
Posts: 7
Joined: Wed Jul 29, 2020 3:17 am

Re: Unable to force sound to headphone jack RPI 4

Post by gofireworks »

Hi, I did not see your reply to this for a long time.

The output of aplay -l is as follows
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3


The output of aplay -L is as follows
null
Discard all samples (playback) or generate zero samples (capture)
sysdefault:CARD=b1
bcm2835 HDMI 1, bcm2835 HDMI 1
Default Audio Device
dmix:CARD=b1,DEV=0
bcm2835 HDMI 1, bcm2835 HDMI 1
Direct sample mixing device
dsnoop:CARD=b1,DEV=0
bcm2835 HDMI 1, bcm2835 HDMI 1
Direct sample snooping device
hw:CARD=b1,DEV=0
bcm2835 HDMI 1, bcm2835 HDMI 1
Direct hardware device without any conversions
plughw:CARD=b1,DEV=0
bcm2835 HDMI 1, bcm2835 HDMI 1
Hardware device with all software conversions
sysdefault:CARD=Headphones
bcm2835 Headphones, bcm2835 Headphones
Default Audio Device
dmix:CARD=Headphones,DEV=0
bcm2835 Headphones, bcm2835 Headphones
Direct sample mixing device
dsnoop:CARD=Headphones,DEV=0
bcm2835 Headphones, bcm2835 Headphones
Direct sample snooping device
hw:CARD=Headphones,DEV=0
bcm2835 Headphones, bcm2835 Headphones
Direct hardware device without any conversions
plughw:CARD=Headphones,DEV=0
bcm2835 Headphones, bcm2835 Headphones
Hardware device with all software conversions
User avatar
MichaIng
Site Admin
Posts: 2488
Joined: Sat Nov 18, 2017 6:21 pm

Re: Unable to force sound to headphone jack RPI 4

Post by MichaIng »

@gofireworks
Meanwhile the issue is known: https://github.com/MichaIng/DietPi/issues/3887
Will be fixed with next release.

If you find time, could you do the following:

Code: Select all

G_CONFIG_INJECT 'hdmi_drive:0=' `hdmi_drive:0=1` /boot/config.txt # forces DVI mode on HDMI port 0
G_CONFIG_INJECT 'hdmi_drive:1=' `hdmi_drive:1=1` /boot/config.txt # forces DVI mode on HDMI port 1
reboot # Reboot to make changes becoming effective
cat /proc/asound/cards
I want to assure that all RPi models in such case do not list HDMI as sound "card" anymore but instead the "Headphones" (3.5mm jack) as card 0.
gofireworks
Posts: 7
Joined: Wed Jul 29, 2020 3:17 am

Re: Unable to force sound to headphone jack RPI 4

Post by gofireworks »

@MichaIng
When I copy and paste the command (with and without `sudo`) I get this error: https://imgur.com/a/7U4NDXk
User avatar
Joulinar
Posts: 3131
Joined: Sat Nov 16, 2019 12:49 am

Re: Unable to force sound to headphone jack RPI 4

Post by Joulinar »

can you try this as user root pls
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply