Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Is there a way? to select output with GPIO?
#1
I'm working on a new project. I've got an old Philco tube radio. I'd like to take the audio from my Raspberry Pi 4 with a HifiBerry Amp2 and using a switch on the GPIO either output audio via the Pi's headphone jack or via the HifiBerry Amp2.

Headphone jack would be "padded down with a couple resistors" then injected into the tube amp bypassing the AM signal. There's a couple ways to do this. I know what I'm doing here. Audio plays out the speaker in the radio.
Flip the switch (GPIO pins)
Audio is routed to HifiBerry Amp2 and goes to the bookshelf speakers at 2x30 watts.

The part of I'm wondering is if there's a way to programmatically switch the output without rebooting the Raspberry Pi?

I don't want to inject the HifiBerry's speaker level output into the radio.

Thoughts?
Reply
#2
The quickest way would be to buy two more Raspberries. Configure one as a moOde multi-room sender, put the other in the radio. Then with the Hifiberry and radio Pi set top be multi-room receivers, you can switch between them or have both playing at the same time even.
----------------
Robert
Reply
#3
(09-28-2021, 09:16 PM)justgeorge Wrote: I'm working on a new project. I've got an old Philco tube radio. I'd like to take the audio from my Raspberry Pi 4 with a HifiBerry Amp2 and using a switch on the GPIO either output audio via the Pi's headphone jack or via the HifiBerry Amp2.

Headphone jack would be "padded down with a couple resistors" then injected into the tube amp bypassing the AM signal. There's a couple ways to do this. I know what I'm doing here. Audio plays out the speaker in the radio.
Flip the switch (GPIO pins)
Audio is routed to HifiBerry Amp2 and goes to the bookshelf speakers at 2x30 watts.

The part of I'm wondering is if there's a way to programmatically switch the output without rebooting the Raspberry Pi?

I don't want to inject the HifiBerry's speaker level output into the radio.

Thoughts?

AFAIK there's no way to dynamically switch between the Pi's integrated audio (HDMI or Headphone) and an attached I2S audio device because the configurations require changes to file /boot/config.txt which is processed during boot. The parameters that change are like below.

/boot/config.txt
Code:
# Headphone or HDMI
dtparam=audio=on
#dtoverlay=some_i2s_audio_device_overlay

# I2S audio device
#dtparam=audio=on
dtoverlay=some_i2s_audio_device_overlay

You might want to investigate i2s audio boards like the one below that integrate an amp + headphone out. You would need to ask the manufacturer if its possible via software to switch between amp and headphone or alternatively if amp and headphone out are active at same time then can the amp be muted/unmuted. Something like that.
https://geekworm.com/products/raspberry-...sion-board
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: