2

Is it possible to read an audio signal through on GPIO pin and give the same signal out through a different GPIO pin or through the audio jack?

I basically want to have 4 audio inputs and one audio input and don't know how to switch these signals using the Pi (else I would use a button/switch).

I already found this Can I get audio input through the GPIO but it says that it should have it but doesn't seem to be connected.

Cludch
  • 133
  • 6

2 Answers2

2

The GPIO (general purpos input/output) pins are digital only. That is, they either read digital values (low or high at certain voltage levels) or output such. Audio signals (at least what I read from the question) are on the other hand analogous. The GPIO pins can neither input nor output* such signals in a useful way.

The task however - to input from multiple sources and to output to different sinks, without signal processing on the Pi's part - on the other hand, could be solved with digitally controlled analog switches. That way the Pi (its GPIO pins) could be used to control the analogue signal without routing it through the Pi itself.

Analog multiplexers or matrix switches could do the trick. See:


* safe tricks like PWM, but that's just solving the output part.
Ghanima
  • 15,578
  • 15
  • 58
  • 113
1

That reference to I2S may actually be a reference to the Wolfson audio card that does connect to the P5 header on later (non- +) RPi models. For the + and 2B (and presumably the 3B) modules you would use the successor from the same people who were bought out by Cirrus-Logic so that device is the Cirrus-Logic audio card - the software and capabilities though are, I understand it, the same between the two...

As to your original question - analogue switching of one-of-four-inputs to an output on an exclusive (only one input selected at a time) basis would take just two GPIO pins (possibly with a third to "mute" the output during a switch or at other times) and some circuitry that could be included in some fairly basic ICs (e.g. this, the ADG1204 from Analog Devices).

SlySven
  • 3,581
  • 1
  • 15
  • 44