09-29-2021, 10:41 AM
(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