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?