Trigger switching

Started by Squeal, December 22, 2005, 11:46:04 PM

Previous topic - Next topic

Squeal

I would like some help with triggerring with audio. Basically I want to build a module that will take an audio (guitar, mainly) input and output an on/off resistance. So when no audio is present, the switch is off. When I play a note, switch turns on. Does that make sense?

Someone on another forum said I could use an optocoupler, and that it would be a strictly on-off output. But I don't know. I know I'll have to turn the audio into DC. Then I could use a comparator to decide what level turns it "on". The output of the comparator would still be a voltage, though. Where do I go from here? Is this a good direction to take?

d95err

The output of the comparator will be maximum voltage or minimum voltage (usually 0). That's basically "on" or "off" in electrical terms. You can use this to control various things such a relay, FET switch, CMOS switch or LED/LDR. What is it that you want to control with the switch?

If you want to use it as a (noice) gate, then a hard switch may be too abrupt for audio. It would probably be better to use a soft on/off design.

gez

#2
Quote from: Squeal on December 22, 2005, 11:46:04 PM
I would like some help with triggerring with audio. Basically I want to build a module that will take an audio (guitar, mainly) input and output an on/off resistance. So when no audio is present, the switch is off. When I play a note, switch turns on. Does that make sense?


Sure, use a comparator fed to a 'retriggerable monostable' with a short cycle (though it has to be just longer than the time period for a complete cycle of the lowest pitch of your instrument).  As long as there's a signal the monostable remains in a high state and can hold the input of an electronic switch high (4016 for example).  The moment the comparator stops providing input pulses (no audio signal) then the cycle for the monostable completes and the the output goes low, turning off the switch.  Although there's a slight delay, we're talking about a fraction of a second so it's not audible.

Check out the 4098 data sheet, a bleedin' marvelous chip!



"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

gez

#3
PS  No need to convert the signal to DC.  Just amplify it and directly feed it to a comparator.  Set the comparator up with just enough bias to keep it in one state (high/low) to avoid mis-triggering.  You might need to adjust the monostable to run on a little longer to avoid gating...bit of a compromise, but a really easy way of doing things (low parts count).
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter


speak_onion

Quote from: gez on December 23, 2005, 05:22:03 AM
PS  No need to convert the signal to DC.  Just amplify it and directly feed it to a comparator.  Set the comparator up with just enough bias to keep it in one state (high/low) to avoid mis-triggering.  You might need to adjust the monostable to run on a little longer to avoid gating...bit of a compromise, but a really easy way of doing things (low parts count).

I know this is an ancient thread, but could you (or someone) elaborate on this?

I found this thread, because this is pretty much exactly what I'm trying to do. I want to send a logic-one or logic-0 (9V or 0V) based on whether there is signal at the input or not. It doesn't have to be retriggerable like a note-detection thing, more like an on/off gate.

The OP was looking for what to do after the comparator, but I'm wondering what to do BEFORE the comparator. I assumed I'd have to convert to DC and I was hoping for guidance on that, but I'm intrigued by the possibility of not converting to DC. Any guidance either way?

gez

Quote from: speak_onion on March 13, 2009, 12:18:05 PM

The OP was looking for what to do after the comparator, but I'm wondering what to do BEFORE the comparator. I assumed I'd have to convert to DC and I was hoping for guidance on that, but I'm intrigued by the possibility of not converting to DC. Any guidance either way?

You don't need to convert to DC, just amplify AC enough so that the comparator triggers for the majority of your signal's decay. This outputs a square wave which in turn triggers the 4098 (details in the data sheet and above posts).  So long as the 4098's time period is slightly longer than the time it takes for the lowest note to complete a cycle, it'll re-trigger from the comparator and keep its output high.  Once triggering stops (tail end of note/no note present), the monostable completes its cycle then provides a logic 0 at its output.  Messing around with the comparators threshold (create a DC offsett for triggering) and/or the time period of the 4098, can eliminate problems with splutter.

Using the 4098 is an alternative to using an envelope follower and you should end up with a lower parts count.  Alternatively, use an envelope follower and use that to trigger a comparator.  Penfold is fond of doing this and sets his comparators up to have 'hysteresis' (thresholds shift depending on state, creating a Schmitt trigger type affair).
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter

speak_onion

Quote from: gez on March 13, 2009, 02:46:39 PM
Quote from: speak_onion on March 13, 2009, 12:18:05 PM

The OP was looking for what to do after the comparator, but I'm wondering what to do BEFORE the comparator. I assumed I'd have to convert to DC and I was hoping for guidance on that, but I'm intrigued by the possibility of not converting to DC. Any guidance either way?

You don't need to convert to DC, just amplify AC enough so that the comparator triggers for the majority of your signal's decay. This outputs a square wave which in turn triggers the 4098 (details in the data sheet and above posts).  So long as the 4098's time period is slightly longer than the time it takes for the lowest note to complete a cycle, it'll re-trigger from the comparator and keep its output high.  Once triggering stops (tail end of note/no note present), the monostable completes its cycle then provides a logic 0 at its output.  Messing around with the comparators threshold (create a DC offsett for triggering) and/or the time period of the 4098, can eliminate problems with splutter.

Using the 4098 is an alternative to using an envelope follower and you should end up with a lower parts count.  Alternatively, use an envelope follower and use that to trigger a comparator.  Penfold is fond of doing this and sets his comparators up to have 'hysteresis' (thresholds shift depending on state, creating a Schmitt trigger type affair).

Hey, thanks this works great.

StephenGiles

Ah, there may be some mileage in trying a 4098 in my Adaptive Space Filter, thanks for the reminder Gez. By the way do you have a fox problem over your way? They have started digging for a den under the decking in next door's garden again!  :icon_redface:
"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

gez

It depends whether you like foxes or not, Stephen!  Yes, the downstairs flat has a den under their decking.  Noisy buggers when they mate at night, but the cubs are cute when you see them around.
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter