migueldad
Posts: 5
Joined: Wed Nov 25, 2020 6:24 pm
Contact: Website Twitter YouTube

How do I force the 3.5 jack over the HDMI?

Wed Nov 25, 2020 6:41 pm

Here is my problem:
When I turn on the raspberry pi with HDMI I do not hear anything from the jack, I would like to use the jack whenever I start Raspberry. I have the Raspbian version 10 (buster).
One of the possible solutions that I have thought is not to allow the audio go through HDMI connection, but to be honest, I don't know how to do it.
[EDIT 1]I need one option permanently, not every day change that.
I need disable HDMI audio output
Last edited by migueldad on Wed Nov 25, 2020 7:17 pm, edited 2 times in total.
Hasta Shakespeare es inadecuado para describir tu perfección.

User avatar
HermannSW
Posts: 3427
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: How do I force the 3.5 jack over the HDMI?

Wed Nov 25, 2020 7:08 pm

"sudo raspi-config"
1) System Options
S2 Audio
1 Headphones
https://stamm-wilbrandt.de/en/Raspberry_camera.html
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/raspiraw
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://stamm-wilbrandt.de/working_with_FPGAs

klricks
Posts: 7422
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How do I force the 3.5 jack over the HDMI?

Wed Nov 25, 2020 7:08 pm

Right click on the speaker icon in task bar and choose Analog.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

W. H. Heydt
Posts: 13953
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: How do I force the 3.5 jack over the HDMI?

Wed Nov 25, 2020 7:10 pm

On the GUI desktop, right-click on the "speaker" icon in the upper right and select "Analog". You can also make that setting by open a terminal window, running "sudo raspi-config", going to "System Options", and then "S2 Audio".

migueldad
Posts: 5
Joined: Wed Nov 25, 2020 6:24 pm
Contact: Website Twitter YouTube

Re: How do I force the 3.5 jack over the HDMI?

Wed Nov 25, 2020 7:52 pm

HermannSW wrote:
Wed Nov 25, 2020 7:08 pm
"sudo raspi-config"
1) System Options
S2 Audio
1 Headphones
klricks wrote:
Wed Nov 25, 2020 7:08 pm
Right click on the speaker icon in task bar and choose Analog.
W. H. Heydt wrote:
Wed Nov 25, 2020 7:10 pm
On the GUI desktop, right-click on the "speaker" icon in the upper right and select "Analog". You can also make that setting by open a terminal window, running "sudo raspi-config", going to "System Options", and then "S2 Audio".
Yes , but when I restart the Raspberry I have to configure it back, I want something permanent, I want that, when i restart the Raspberry, the system ignores the hdmi audio output
Hasta Shakespeare es inadecuado para describir tu perfección.

klricks
Posts: 7422
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: How do I force the 3.5 jack over the HDMI?

Wed Nov 25, 2020 8:36 pm

migueldad wrote:
Wed Nov 25, 2020 7:52 pm
....
Yes , but when I restart the Raspberry I have to configure it back, I want something permanent, I want that, when i restart the Raspberry, the system ignores the hdmi audio output
The setting is persistent after reboot for me. Not sure why yous is not?
Are other settings or file edits persistent after reboot?
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

migueldad
Posts: 5
Joined: Wed Nov 25, 2020 6:24 pm
Contact: Website Twitter YouTube

Re: How do I force the 3.5 jack over the HDMI?

Thu Nov 26, 2020 7:30 am

klricks wrote:
Wed Nov 25, 2020 8:36 pm
migueldad wrote:
Wed Nov 25, 2020 7:52 pm
....
Yes , but when I restart the Raspberry I have to configure it back, I want something permanent, I want that, when i restart the Raspberry, the system ignores the hdmi audio output
The setting is persistent after reboot for me. Not sure why yous is not?
Are other settings or file edits persistent after reboot?
Yes but the problem is the next,
I have raspotify and when it starts it takes the audio output from the HDMI
Hasta Shakespeare es inadecuado para describir tu perfección.

BMS Doug
Posts: 4293
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: How do I force the 3.5 jack over the HDMI?

Thu Nov 26, 2020 7:43 am

migueldad wrote:
Thu Nov 26, 2020 7:30 am

Yes but the problem is the next,
I have raspotify and when it starts it takes the audio output from the HDMI
So the issue is with Raspotify then, has been around for awhile:

https://github.com/dtcooper/raspotify/issues/22
berrnd commented on 1 Oct 2017
Hi,

had the same problem and stumbled over this while searching ... got it working by adding --onstart 'sudo amixer cset numid=3 1' --onstop 'sudo amixer cset numid=3 0' to OPTIONS.

See the Raspberry Pi documention, you also maybe have to add raspotify ALL = (root) NOPASSWD: /usr/bin/amixer to your /etc/sudoers.


Edited to update because:
hippy wrote:
Thu Nov 26, 2020 11:30 am
Just to note : Due to changes to Raspberry Pi OS around the same time as the Pi 4B 8GB was launched, "amixer cset numid=3" no longer works for setting audio routing. You now have to edit the "~/.asoundrc" file, and that may be changing in future as Raspberry Pi OS moves to using PulseAudio.
Last edited by BMS Doug on Thu Nov 26, 2020 12:01 pm, edited 3 times in total.
Doug.
Building Management Systems Engineer.

BMS Doug
Posts: 4293
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: How do I force the 3.5 jack over the HDMI?

Thu Nov 26, 2020 7:53 am

Another reply to the same thread (offering a different solution):
xtraminty commented on 29 Mar 2018 •
I was having the same issue and just wanted to post the (fairly) simple fix I found for it. It's a little messy but it still works anyway.

Anyway, I'm running OSMC, which as it's not Raspbian means I can't use the Raspi config method or anything with the amixer. Instead what I found to do was edit the actual /boot/config.txt file using a simple sudo nano and added hdmi_ignore_edid_audio=1

I don't fully understand why it works but I think the command stops any sound to the display and so the service instead defaults to the analogue output. I presume this command would also mean anything else you had running that wasn't OSMC/kodi would also default to analogue audio. OSMC still works fine with audio coming out over HDMI and/or analogue so no issues there
Doug.
Building Management Systems Engineer.

hippy
Posts: 8872
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How do I force the 3.5 jack over the HDMI?

Thu Nov 26, 2020 11:30 am

https://github.com/dtcooper/raspotify/issues/22
... got it working by adding
--onstart 'sudo amixer cset numid=3 1' --onstop 'sudo amixer cset numid=3 0'
Just to note : Due to changes to Raspberry Pi OS around the same time as the Pi 4B 8GB was launched, "amixer cset numid=3" no longer works for setting audio routing. You now have to edit the "~/.asoundrc" file, and that may be changing in future as Raspberry Pi OS moves to using PulseAudio.

migueldad
Posts: 5
Joined: Wed Nov 25, 2020 6:24 pm
Contact: Website Twitter YouTube

Re: How do I force the 3.5 jack over the HDMI?

Thu Nov 26, 2020 3:32 pm

BMS Doug wrote:
Thu Nov 26, 2020 7:53 am
Another reply to the same thread (offering a different solution):
xtraminty commented on 29 Mar 2018 •
I was having the same issue and just wanted to post the (fairly) simple fix I found for it. It's a little messy but it still works anyway.

Anyway, I'm running OSMC, which as it's not Raspbian means I can't use the Raspi config method or anything with the amixer. Instead what I found to do was edit the actual /boot/config.txt file using a simple sudo nano and added hdmi_ignore_edid_audio=1

I don't fully understand why it works but I think the command stops any sound to the display and so the service instead defaults to the analogue output. I presume this command would also mean anything else you had running that wasn't OSMC/kodi would also default to analogue audio. OSMC still works fine with audio coming out over HDMI and/or analogue so no issues there

I tried that option but it doesn't work, this is my "config.txt"

Code: Select all

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=2
#hdmi_mode=4

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

hdmi_ignore_edid_audio=1
Hasta Shakespeare es inadecuado para describir tu perfección.

migueldad
Posts: 5
Joined: Wed Nov 25, 2020 6:24 pm
Contact: Website Twitter YouTube

Re: How do I force the 3.5 jack over the HDMI?

Thu Nov 26, 2020 3:36 pm

hippy wrote:
Thu Nov 26, 2020 11:30 am
https://github.com/dtcooper/raspotify/issues/22
... got it working by adding
--onstart 'sudo amixer cset numid=3 1' --onstop 'sudo amixer cset numid=3 0'
Just to note : Due to changes to Raspberry Pi OS around the same time as the Pi 4B 8GB was launched, "amixer cset numid=3" no longer works for setting audio routing. You now have to edit the "~/.asoundrc" file, and that may be changing in future as Raspberry Pi OS moves to using PulseAudio.

I've also tried that, but it doesn't work either, this is mi .asoundrc
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "output"
}
capture.pcm {
type plug
slave.pcm "input"
}
}

pcm.output {
type hw
card 1
}

ctl.!default {
type hw
card 1
}
This is my raspotify config:
# /etc/default/raspotify -- Arguments/configuration for librespot

# Device name on Spotify Connect
DEVICE_NAME="EspejoDAD"

# Bitrate, one of 96 (low quality), 160 (default quality), or 320 (high quality)
BITRATE="160"

# Additional command line arguments for librespot can be set below.
# See `librespot -h` for more info. Make sure whatever arguments you specify
# aren't already covered by other variables in this file. (See the daemon's
# config at `/lib/systemd/system/raspotify.service` for more technical details.)
#
# To make your device visible on Spotify Connect across the Internet add your
# username and password which can be set via "Set device password", on your
# account settings, use `--username` and `--password`.
#
# To choose a different output device (ie a USB audio dongle or HDMI audio out),
# use `--device` with something like `--device hw:0,1`. Your mileage may vary.
#
OPTIONS="--device hw:1"

# Uncomment to use a cache for downloaded audio files. Cache is disabled by
# default. It's best to leave this as-is if you want to use it, since
# permissions are properly set on the directory `/var/cache/raspotify'.
#CACHE_ARGS="--cache /var/cache/raspotify"

# By default, the volume normalization is enabled, add alternative volume
# arguments here if you'd like, but these should be fine.
#VOLUME_ARGS="--enable-volume-normalisation --linear-volume --initial-volume=100"

# Backend could be set to pipe here, but it's for very advanced use cases of
# librespot, so you shouldn't need to change this under normal circumstances.
#BACKEND_ARGS="--backend alsa"

I've already tried changing hw:1 to hw:0 but it still doesn't work
Hasta Shakespeare es inadecuado para describir tu perfección.

Return to “General discussion”