latching for a line level audio signal

I need to do two things: listen to an audio stream and detect when it surpasses an average threshold amplitude; and when that happens, send the audio at line levels to another device.

The first I'm not too concerned with. The second is my question here. I really want a pulse at a given pin to turn on the feed. Then, as the arduino keeps listening, if that input drops below a given level, a pulse on a different pin to turn off the feed. In other words, when it's louder, the audio passes through, when it drops below a given point, it turns off.

I can imagine that this can be done with relays. I would like to not have to keep the relay powered all the time, so that's the question here.

How can get this happening at a hardware level?

Sounds like a 'latching relay' will do exactly what you want.

You can get "analog switches" which are solid state devices for switching low-power signals. But relays are more foolproof because a relay is just an electrically operates switch and the audio can go through with no additional noise or distortion. (Analog switches don't necessarily damage the signal but it can be tricky.)

Either way, add some 100K "pull down" resistors to keep open-unconnected audio lines from floating-up. If that happens you can get a click or pop when switching-on.

Google “envelope detector” - circuits that track the peak amplitude with various time constants
in their response.

With an Arduino you can do the equivalent thing in software from ADC sampling.

There are many ways to actually switch a signal - can you clarify the nature of the audio signal,
the maximum amplitude, the impedances of the source and destination devices, etc.?

So as a general reply to all: as a software guy, is there a schematic someplace that shows me how to connect the latching relay to the arduino? I'm imagining that there are 5v input pins on either side of the relay and a ground, and that I just need to set those pins momentarily high to get it to change state? It's important that I know what state the relay is in, so I can't use a toggle type on a single pin. Do I need to put resistors or something between the pins driving the relay and the relay itself? I take it this is what brings the current up to the level where the relay can be pulled into its alternate state?

As far as the signal in goes: I could fit this into the amplified output end, but I plan to put the relay inline with the input end, and those signals will be coming off of a standard Lavalier-type receiver, levels that a standard audio amp will handle.

Out of interest, what keeps the relay in the state it's in? I've read that there are magnetic types, where a blade internally flips between two plates, with a magnet sticking the plate into its last set position. Is it that mechanical, or is there a solid state option that can maintain the setting without power?

urbanistica:
Out of interest, what keeps the relay in the state it's in? I've read that there are magnetic types, where a blade internally flips between two plates, with a magnet sticking the plate into its last set position. Is it that mechanical, or is there a solid state option that can maintain the setting without power?

Never saw one with magnets. I dealt with ones with mechanical tabs which maintain the relay state without power. One coil for latch, one for unlatch. If you get a 3-pole double throw you can have your signal denoting which state the relay is in.

urbanistica:
Out of interest, what keeps the relay in the state it's in?

A spring, like in any other two-position switch. Remember a relay is just a switch...
Standard relays are like momentary push-buttons and require constant activation.
Latching relays are like toggle switches.

Most latching relays have either one bidirectional coil or two coils. The latter are
easier to drive, just looks like two ordinary relays.

Single coil versions need a bias magnet - coil either adds to or subtracts from the magnetic field.
Two coil versions can be like this (with a centre tap on the coil), or have separate coil assemblies that
pull in different directions without needed magnetic bias.

[ I recommend taking a relay apart, or at least buying one with a see-through cover - see though
ones are much easier to check for arcing or contact wear as you can see the mechanism ]

I may be barking up the wrong tree here, but for an audio signal wouldn't we just want to use an OP-amp rather then a relay ?

a latching comparator is what he needs. Can be done with op-amp.

Deva_Rishi:
I may be barking up the wrong tree here, but for an audio signal wouldn't we just want to use an OP-amp rather then a relay ?

"Barking up the wrong tree", indeed you are. As explained in reply #2, an analog switch - such as a 74HC4066 is the appropriate solid-state part and requires no current to maintain its state.

The problem is of course, that the original question is poorly described, generally an "XY problem" asking how to do something without adequately explaining what it is that really needs to be done. There is much more involved in the actual circuit and only when the full details are to hand could any serious advice be offered.

As is so often the case. :grinning:

Paul__B:
As explained in reply #2, an analog switch - such as a 74HC4066 is the appropriate solid-state part and requires no current to maintain its state.

Well i was actually thinking more along the lines of having a bit of a soft-fade, considering in effect that OP wants to create a gate.
just to expand in my thoughts here a little. and people were talking about relays, and that just didn't seem right. (see through so you can see how it's wearing and all)

It’s possible to fade with a relay. It’s just capacitance.

wolframore:
It’s possible to fade with a relay. It’s just capacitance.

if it's a DC signal i would totally agree with you, now i am not convinced and any capacitor on the line would seriously compromise the signal.

The capacitance has to be on the power circuitry

wolframore:
The capacitance has to be on the power circuitry

but the relay is a switch…

I can do it. I’ll play with the idea.

Deva_Rishi:
Well I was actually thinking more along the lines of having a bit of a soft-fade, considering in effect that OP wants to create a gate.

Well, an op-amp is nothing more than an amplifier. To implement a soft fade (in order to avoid switching "pops"), you need a multiplier. Generally this is done with a FET (specifically, dual-gate FETs) though a LDR in a black tube with a LED is a practical approach.

Reminds me of the optical compressors of yore. I have a tube one that uses a light bulb for this.

And that gives a very soft turn-on, and and even softer turn-off.

LEDs vastly reduce the current consumption.

Now i think that is the way to go, i mean detailed audio electronics (or even general electronics among you guys) is not my specialty. But i am a music producer by hobby.
If you want a switch use a switch if you want a fader use a fader, and in this case i think a fader is better then a switch. preferably a fader that can be pwm controlled, fades ranging from 0-10 ms would be my preference. Still maybe the OP is happy with the switch as it was suggested earlier.