Making a generic envelope follower

Started by soggybag, September 27, 2005, 11:56:52 AM

Previous topic - Next topic

moosapotamus

Here's something really, really simple...



... from an older version of Tim Escobedo's Ugly Face.
An LDR opposite the LED can go across the outside lugs of a pot that is wired as a variable resistor.
That's what I used in my CrashSync. :icon_cool:

~ Charlie
moosapotamus.net
"I tend to like anything that I think sounds good."

soggybag

I think I tried this and couldn't get it to work. But then again I don't really know what I'm doing either. Maybe I'll give it another try.

would you need a buffer to drive it if your input was split between this and the effect circuit?

Dave_B

Quote from: StephenGiles on October 01, 2005, 01:27:38 PM
I'm not convinced we want to follow the waveform because that is probably asking for ripple.
You're right, I should clarify that.  What I meant to say was, "Sample the initial peak, then follow the peaks down (not the waveform)."  In theory, that's easy.  In reality, there must be a reason it isn't commonplace.
Help build our Wiki!

Dave_B

Quote from: soggybag on October 01, 2005, 04:51:08 PM
I think I'm with Stephen, an envelope generator might be a better choice. A PIC has great potential but you need special equipment to create and program the PIC, not to mention the know how.
For what it's worth, I built my programmer for $3.66, a broken mouse, and some spare diodes and caps.  The software to program them is free.

Here's the schemo: http://www.olimex.com/dev/images/pic-pg1-sch.gif

As I mentioned earlier today, I haven't had the courage to plug it into the computer yet, but I expect to before the weekend is over.  It's good to hang on to old P-II motherboards for  events like this.    :icon_biggrin:
Help build our Wiki!

R.G.

QuoteI feel there must be simple effective envelope that can be used in many circuits. Something that can be made with a single op-amp and a few more parts. A complex circuit is not as useful, and causes problems for amateurs like myself. I had the idea of coming up with something that could be grafted onto any circuit where you felt an envelope might enhace or create new sounds.
Yes, right! Good idea. I love it.

The problem is, I don't know of anyone that has been able to do that, and I've looked for a long time. The closest to a single chip (not single opamp) envelope follower is the old double full wave rectifier done with an NE570/571. It's pretty good because double-full-wave quadruples the frequency of the ripple and makes the filtering easier. I guess you could do something similar with a quad opamp or three rail-to-rail opamps that had input common mode ranges below the minus supply.

Einstein said "Everything should be as simple as possible, but no simpler." I hope you are successful, but don't be hard on yourself if you're not. A lot of people have looked for that kind of circuit for a lot of years. I banged my head on it quite a few times, and the complexity to do a good envelope extractor just grew. Frankly, Bissell's is the highest performance per circuit cost I know of. There may well be better ones at lower circuit cost, but I haven't seen them.

A good envelope extracter has conflicting requirements, always a good hill to climb. It has to find peaks, no matter what time difference there is between them for frequencies of interest, and then smooth them. Problem is, the smoothing you need for the lowest guitar frequencies is too much for the high frequencyies. Get the highs right and you have ripple on the lows. I think that some commercial units may use dual (or triple or fourple) frequency bands for finding the envelope.
QuoteYou're right, I should clarify that.  What I meant to say was, "Sample the initial peak, then follow the peaks down (not the waveform)."  In theory, that's easy.  In reality, there must be a reason it isn't commonplace.
Yep. The reason I personally haven't done it is because I can't get today's PICs to digitize audio fast enough to digitize audio and catch the peaks, then compute something to do with them in real time. In theory it's easy. A good high audio-capable DSP should be able to do it in real time, but cheap and available PICs can't as far as I can tell. To catch guitar peaks, you have to be able to digitize well enough to find peaks on a 7kHz waveform. That means that you have to sample a minimum of three times per half cycle, probably more like five - I haven't done the math to figure out the necessary oversampling rate. Note that finding a peak on a waveform is a more stringent criteria than reproducing the waveform by sampling. At least as I dimly understand it.

Maybe there's a combination of analog and PIC processing that can do it.

I can postulate an oversampling sigma-delta modulator that could find peaks and then limit its up/down rate based on the time between peaks, but I haven't tried to design that.

PIC programming is trivially easy, needing no really fancy equipment that can't be made easier than an effects box.

QuoteWhy couldnt you have the envelope detector as a separate box with a CV out, like analogue synths?
then just mod your pedals so that they could take a CV in, and have some sortof switching to switch between which values are controlled by the envelope of your signal.
Good idea. I thought that a good envelope detector would make a good module for the FxBus. However, it does violate one of what I fuzzily perceive the rules are for stompboxes - make it all fit in one box so the guitar player can just think about what that one box does. I could be wrong, but that's what I think.

I really don't want to discourage anyone, because I'd like to see a simple one opamp high performance envelope detector too.


R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

H^)harry

everybody having a party and they didn't invite me ???    :^P

Some comments from horse's mouth   (not the other end...)

My "Envelope follower combines feat response, lowest ripple" from EDN
has some real advantages ~and~ disadvantages.  It was designed for guitar
in specific. Guitar waveforms can have multiple zero crossings in a cycle...
and can have multiple peaks of essentially the same amplitude. Simple circuits
that look for the highest peak between zero crossings don't work well for guitar
(an example would be the circuit posted on Rene Schmitz's website, from the
synth-diy list).

I decided to trade having a really accurate attack for having the decay phase
delayed by about 1-1/2 cycles.  You don't notice this easily. If you mute a guitar string
it will probably ring longer than this anyway.

The down side of this circuit is you have to know the lowest fundamental frequency
in the input. Iused this in a polyphonic envelope follwer, so I do know the lowest possible note. If you use this circuit on a general audio signal (radio ?) you will need to set the clock REALLY slow...
in which case its a really complex circuit to get crappy performance with   :^P

There are other ways to do this circuit.   I did a version using a 4053 CMOS switch to run the
sample holds AND the resets.  Its a little more compact.

The full cirucit for the hex version of my guitar processor is at Larry Hendry's
www.wiseguysynth.com. Look for "muffy"

This is my first post here.  Does anyone know how I could kill those animated emoticons on
the post composition screen.  They make my computer run REALLY dog slow.  I can barely
type.

H^) harry  (bissell)

Paul Perry (Frostwave)

It's certainly possible to sample beyond 20KHz with a PIC! My Sonic alienator does that, plus a tiny bit of elementary processing as well, then sends the output to a serial D to A.
but it hardly has to do that in the case of an envelope follower, because in an envelope follower... well, what do we want? Do we REALLY want the absolute envelope? If you get into a sound editing program & expand the waveform right out, you will get some insight into what might work int eh real world.. especially if you print out the waveform, and cover it with a card, which you slide away so that the waveform is progressively revealed. You quickly find that you can't easily generate a 'perfect' envelope even with your brain & a pencil! (yeah, it's easy if you can see the WHOLE waveform, including what is coming, but that is cheating).
So the question is, how WELL can one do?
Personally, I'd try a tradional follower, with a very small cap, then sample the output at about 1khz, and choose the maximum reading during the last .05 seconds.

soggybag

I'm far from discouraged! I think sometimes the idea of performance dominates design too much. I don't feel the envelope needs to be so high performance or complex for many uses. I think you just need to hear the effect in time with the instrument.

Take the Ugly Face for example. I think this uses a single 2u2 cap and vactrol for the envelope. It sounds good, I don't think I notice any ripple (of course it's probably masked pretty well by raucous square wave produced by the Ugly Face). I think this is simple and effective.

I keep thinking that a guitar signal through an LED/LDR could make a pretty simple envelope with the righ amount of low pass filtering, or... something else that I haven't thought of yet!

The Dr. Q envelope works pretty well with a minimum of parts. I suspect it can still be smoothed out some. I added a buffer on the front, I suspect you could drop this into a lot of projects with little effort. It probably  could use some improvement.

There is an issue of Stompboxology all about envelopes. On the second page Mr. Boscorelli shows about 8 different envelope circuits and none of them are that complex. He also talks about the types of envelopes generated. I'm not sure how people feel about this but I would be willing to post this page for discussion?

H^)harry

Reply to Paul Perry (Hi Paul)

The PIC should be pretty easy... I'd use one resettable
peak detector.  Have the PIC read the value stored, then
save that in a buffer.  Do that three times and output the
highest value you saw.  After each read, dump the peak
detector. The peak detector could be a simple opamp
circuit and dump it with a transistor.

What you really WANT depends on the use for the follower.
I don't like IM distortion in my VCA or VCF so the extra effort
is worth it.   If I was trying to track drums, I'd use the peak
detector.  The guitar case is unique because of the ability of
MUTING the strings suddently....

H^) harry

StephenGiles

Hi Harry - welcome to the forum, we had a brief exchange of emails a couple of years ago regarding your envelope follower. Now, I didn't appreciate at the time that a fundamental extractor is required in order to get maximum performance. Well, we have one from the EH Guitar Synth which I know works, albeit with a high component count here:
http://ampage.org/hammer/files/EH-Guitar-Synth.ZIP
.so that's a possibility, but what does your fundamental generator consist of?
"I want my meat burned, like St Joan. Bring me pickles and vicious mustards to pierce the tongue like Cardigan's Lancers.".

R.G.

Harry -
QuoteThe down side of this circuit is you have to know the lowest fundamental frequency in the input. Iused this in a polyphonic envelope follwer, so I do know the lowest possible note. If you use this circuit on a general audio signal (radio ?) you will need to set the clock REALLY slow...
This is the ripple problem in another guise. Or, more properly, the problem behind the ripple problem. Your diode-OR in the output offers a solution in that you can create a lowest-couple-of-octaves envelope detector running from a lowpass filter and detect them the same way, then OR them in.

I was curious at the loss of envelope level with the diodes in the diode OR. Are you working only with a preamplified signal, not raw pickup level? It seems like losing half a volt of envelope would be a disaster with a 100mv signal. Or did I set up my simulation wrong? I used active diodes to get rid of the forward voltage and it simmed well with pickup level signals then. The second diode in series with the 100 ohm resistor isn't the same kind of problem, paralleled with a 100K. Can you expound a bit on the reasoning in that area?

QuoteThere are other ways to do this circuit.   I did a version using a 4053 CMOS switch to run the sample holds AND the resets.  Its a little more compact.
Do you have a schematic for that that you're willing to share?

I really like the stepping-sideways involved with your envelope generator. Clever.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Transmogrifox

Here's a circuit I've been toying with in PSPICE:

http://putfile.com/pic.php?pic=10/27413130337.jpg&s=x2

It's a self-clocking sample & hold cell.   The first stage (into the opamp inverting side through a capacitor) is a differentiator amplifier, thus the output is a first derivative.  The next part with the comparator is a 0 crossing detector, which also serves as a nonlinear second derivative, in that the output reveals whether the peak is a positive or negative peak.

The final stage is a quick and dirty one-shot to generate a short pulse for sampling.  The switch model shown could be a 4053 or 4066 analog switch.

I'm operating off the student version of PSPICE, so I'm lacking the ability to try this, but I suspect that if you put two of these in series, it would detect the envelope of almost any audio signal.  The other problem I would have with a simulation even with a full version of SPICE is that I would have to apply a realistic audio signal over a much longer simulation run.

It worked very well using the ideal switch for the S/H on a "nice" signal that had been generated by summing 5 AC sources of different amplitudes.  The main thing I wanted to see was that it faithfully set a short pulse on each concave down peak, but nowhere else, according the the theory.  It did quite well.  There was a more noticeable lag near 1kHz, but not so much that it was sampling the waveform at illogical places.  It was about 10% error in the 1kHz range, but more like 1% error at 400 Hz.   I think my next step is to build it and try it.  It's more simple than my current envelope follower that uses a full-wave rectifier and a 5th order low pass filter (who's 3dB frequency depends on the lowest expected audio frequency)
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

moosapotamus

Quote from: moosapotamus... from an older version of Tim Escobedo's Ugly Face.

Quote from: soggybagI think I tried this and couldn't get it to work. But then again I don't really know what I'm doing either. Maybe I'll give it another try.
I'd definately recommend giving it another try. I think it fits your initial design objective quite well...

Quote from: soggybagI feel there must be simple effective envelope that can be used in many circuits. Something that can be made with a single op-amp and a few more parts. A complex circuit is not as useful, and causes problems for amateurs like myself. I had the idea of coming up with something that could be grafted onto any circuit where you felt an envelope might enhace or create new sounds.
It worked great for me in my AutoCrash which is a Crash Sync with the envelope follower modulating the frequency. And IIRC, this little follower circuit (or the LM386 version) was also used by someone else here to modulate the speed in a tremolo circuit. So, it works pretty well as a simple drop-in envelope follower. :icon_cool:

Quote from: soggybag...would you need a buffer to drive it if your input was split between this and the effect circuit?
Possibly... input ties to Q1 collector in the Uglyface. In my Autocrash the input tied to the TL072 pin 1.

~ Charlie
moosapotamus.net
"I tend to like anything that I think sounds good."

H^)harry

Hello All

(Steven Giles)  When I say 'know' the fundamental frequency, I mean what the lowest frequency
might be. For instance, Low E of guitar is 80Hz.   If you actually KNOW the fundamental (a'la
the EH Guitar Synth or other) you can just use one peak detector and sample once every cycle.
You need a circuit to determine when a note has stopped, then force one more sample of 'zero'
volts to end the note.  In my guitar synth I use this method rather than the envelope follower from EDN.

(RG)  I use the circuit after a preamp.  The diode drops actually help to establish a 'full off'
level for the follower.  I have a circuit that sum the S/Hs actively... no diode drop.  It did not improve
this application IMHO so I did not use the more complex circuit.

The envelope follower question is really interesting... your eye can 'see' the proper envelope in a scope
but is is really hard to detect it electronically. 

I follow the fast envelope with a circuit similar to the "morphlag' over at Larry Hendry's site
www.wiseguysynth.com

REQUEST : Please, can anyone tell me how to abort the animated emoticons on the posting
page. Its costing me ONE SECOND per letter... I can't get much done. Is there a text-only page available ???

H^) harry

H^)harry

Hello Transmogrifox

I saw your simulation, I'll check it more carefully. I'd suggest you use
thee sine wave generators with the following settigns

1: 1V @ 80Hz
2: 0.5V @ 161Hz
3: 0.33V @ 243Hz

Sum these together and  scale them to suit your test. This will be the first three
harmonics of a 'sawtooth' wave... with the upper harmonics made sharp for guitar
string 'stiffness'.   You will get the traditional guitar wave this way, with multiple peaks
and zero crossings.

I test my circuits with this stimulus. I even use a multiplier as a VCA to fake an exponential
decay.

Using a single sine wave source will make (almost) ANY circuit seem to work.

H^) harry

Transmogrifox

Quote from: H^)harry on October 02, 2005, 05:29:07 PM
Hello Transmogrifox

I saw your simulation, I'll check it more carefully. I'd suggest you use
thee sine wave generators with the following settigns

1: 1V @ 80Hz
2: 0.5V @ 161Hz
3: 0.33V @ 243Hz

Sum these together and  scale them to suit your test. This will be the first three
harmonics of a 'sawtooth' wave... with the upper harmonics made sharp for guitar
string 'stiffness'.   You will get the traditional guitar wave this way, with multiple peaks
and zero crossings.

I test my circuits with this stimulus. I even use a multiplier as a VCA to fake an exponential
decay.

Using a single sine wave source will make (almost) ANY circuit seem to work.

H^) harry

I, in fact have done that with that pattern of relative amplitudes up to the 5th harmonic (starting with 80 Hz).  I actually did a few more using the same pattern by shifting it all up to the A string relative harmonics and a few extras.

What I was missing, and appreciate your input for is using a multiplier as a VCA to fake an exponential decay.  This would give me a much better idea of how this thing responds to envelope changes.

From the simulations I did, I could immediately tell that a single stage of this would be useless since it also samples at positive peaks that occur below 0 on the Y axis.  If that output was filtered, then put through a second stage of this, then it would work very well on a well-behaved signal.  That's why I am more interested in actual audio signals--so at this point it's easiest for me to breadboard it and see how it works in real life.  The theory seems good.

I appreciate your input.

Soggybag:  sorry for steering this off topic.  This is not a generic, nor simple envelope follower concept.
trans·mog·ri·fy
tr.v. trans·mog·ri·fied, trans·mog·ri·fy·ing, trans·mog·ri·fies To change into a different shape or form, especially one that is fantastic or bizarre.

Joe Kramer

#36
Quote from: R.G. on October 01, 2005, 10:21:51 PM
The closest to a single chip (not single opamp) envelope follower is the old double full wave rectifier done with an NE570/571. It's pretty good because double-full-wave quadruples the frequency of the ripple and makes the filtering easier.

I've seen this circuit also, and although I haven't tried it yet, it struck me as possibly having a high performance/simplicity ratio (as per Einstein), considering it only takes about 10-12 parts including the 570/571.  Seems like a very tight layout would be possible, plus it's single supply. 

RG, you say it's pretty good.  Better than?  Not quite as good as?  Thanks.

Joe

Solder first, ask questions later.

www.droolbrothers.com

soggybag

Transmogrifox: No worries, this is a good subject and needs discusison.

I would like to see the NE570/571 envelope can anyone point me to a schematic?

I keep thinking there is a simple solution that would work for may guitar applications and built around an LED/LDR driven by the guitar signal and smoothed by some filtering and the lag of the LDR.

H^)harry

The 'double rectification' technique really does not help with a guitar input.
The typical guitar wave has one large peak, and two smaller peaks of opposite
polarity.  Rectify that twice and the extra peaks you WISH would fill in the gaps
simply won't. They are sure to be below the main peak and won't help at all with
the ripple. Another good-idea-on-paper.  It seems to work on a sine wave, but even then
the extra peaks are way too thin to deliver much extra charge to the filter cap.

What 'could' work is the roland quad-rectifier idea from their is it SPV-355.  It only works
with an infinitely compressed signal.  You might do something like it with tapped BBDs
(yes... I considered that :^).  That is what led me to the triple peak detector method.

BTW before someone TRIES this... I made an 8 peak detector model, thinking it would
be an improvement. Its not. Three is the ~magic~ number to be sure of having the peak in any full cycle.

If you want the other features of the 570/571 etc... its an OK chip.  Hit it with 80Hz
or even 40Hz and you are hosed, ripple wise vs response time.  Note most compander
systems work in the high frequency range where you get some benefits and response vs.
ripple is less of an issue.

I really wish this didn't suck the way it does, but thats the nature of the beast.


H^) harry

gez

Quote from: H^)harry on October 02, 2005, 05:07:02 PM
REQUEST : Please, can anyone tell me how to abort the animated emoticons on the posting
page. Its costing me ONE SECOND per letter... I can't get much done. Is there a text-only page available ???

Best thing would be to report it in the problems thread at the top of the main index.  Perhaps if you type your reply in Works/Word/Notepad then paste it into the reply box it would be easier?
"They always say there's nothing new under the sun.  I think that that's a big copout..."  Wayne Shorter