I had an idea to build an audio switching device that automatically switches between two inputs to a single output. My exact application would be to have music playing on a speaker while monitoring a portable 2-way radio. When the radio receives a signal it cuts the music and plays the radio transmission over the speaker. After some searching I found a commercial product that I believe would do what I want, but it is cost prohibitive for my application.

I had the idea to use a 5 V relay to switch the ground for the speaker between the two audio sources but I am having difficulty figuring out how to convert the line-level audio signal from the radio to 5 V to actuate the relay. Would it be possible to use an op-amp to amplify the signal and rectify it to apply it to the control pin on the relay? Is there a simpler or more efficient way to accomplish my goal?

  • 3
    \$\begingroup\$ Switching the ground probably won't work well, especially if the two sources share a ground anyway. Switch the hot lead instead. But yes, what you propose is quite possible. \$\endgroup\$
    – Dave Tweed
    Mar 26 at 23:56

1 Answer 1


You don't need a relay for that purpose but no one would stop you. If you will be happy with clicking noise then go for it.

There are CMOS SPDT switch ICs available which can be an alternative to relays. They allow you to select one source from two and direct it to the output. They are widely used in audio processing and video applications.

Here's a simplified schematic to give you a rough idea:


simulate this circuit – Schematic created using CircuitLab

The peak detector, as the name suggests, takes the peak of the input. So if there's a signal sound at AUDIO_SRC_2 then the peak will be non-zero (neglecting the noise). And this non-zero output is used as a control signal for the SW_IC to switch the inputs. For more precise control you can use an amplifier and/or a comparator.

One thing worth to mention is that the source may switch back to AUDIO_SRC_1 if the sound at AUDIO_SRC_2 has muted sections (i.e. breaks). If you don't want such thing to happen you may want to use a latch for the control signal of the SW_IC.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.