Z-1 or not? Klockable Envelope Generator

In the fine Audulus tradition of emulating Eurorack hardware, I decided to have a go at the 4ms PEG (Pingable Envelope Generator). For those of you not familiar with the original, this is a clocked envelope generator (AR or ASR). The original is a dual unit but I chose to make mine single since it’s easily duped. I pretty much mirrors the original with the exception of the curve control. I used two knobs (one for rise and one for fall) rather than a combined knob. I also omitted the scaling and bipolar inversion, since scaling is easily done externally. The envelope output is 0-1. See http://4mscompany.com/peg/manuals/PEG_manual_v4.3.pdf for details on its operation. Before I finalize the design, I wanted to get some feedback. I currently have a z-1 node in the feedback loop from the skew unit to the ramp generator. This works fine, but almost doubles the CPU usage. If you remove it, Audulus will insert a feedback delay which will cause a small glitch in the envelope when it is running in Asnyc mode and switches from attack to sustain (hold async gate high). I would welcome any feedback before I post it in the modules section. Debugging help is alway appreciated.
klock - input clock - sets the envelope duration - see PEG documentation for “ping”
async - async gate input
qnt - quantized gate input
rs -reset
cycle toggle and input - selects cycle mode - input inverts toggle
Tap - sets envelope duration if klock is not used
Skew - ramp to triangle to reverse ramp
* - sets input clock div/mult from 1/8 to 8
Rise Curve - controls rise portion curve
Fall Curve - controls fall portion curve
env - envelope
c - div/mult clock out
r - rise (Attack) gate
f - fall (Release) gate
fr - frequency out

File posted here: KEG Klockable Envelope Generator

1 Like

For clarification, when the gate is held high for the async input there should or should not be a sustain portion to the envelope?

Also, you could leave the choice of whether to use the z-1 node by leaving it convenient to change with a little note.

PS here is a Div node for your collection Div Node.audulus (226 Bytes)

1 Like

When the async input is held high the envelope should sustain until the gate drops. Your solution has some merit, I couldn’t decide if the small glitch was worth the extra CPU hit.

1 Like

Ok I think I see the glitch now. I don’t think it’s super noticeable to be honest. One thing I would double check is if re-triggering the envelope cuts off the decay stage on the PEG. I found the clicks coming from the cut off decays to be a more noticeable source of unexpected behavior.


Over all it’s another great module with lots of bits to absorb.

1 Like

Retriggering in async mode does cut off the delay on the PEG. The PEG does have some slew limiting on the envelope to prevent clicks, perhaps I should add some too.

1 Like

I added a low-pass filter to the output. Still needs a bit of fine tuning

1 Like

A slew limiter is probably the way to go, digital filters are truly amazing.

While I was out walking the dog, I thought of a workaround for anyone who wants overlapping decay and attack signals


overlapping decays.audulus (132.2 KB)

I think I might cross apply this idea to the karplus-strong patch I got going in the other window to make some overlapping plucked strings.


Neat idea! Another interesting way to use polyphony. I looked at your KS patch but haven’t figured out why it resonates the way it does. I’ll be interested to see what people do with this. The PEG is a pretty non-traditional envelope generator. I’m not really sure if it thinks it’s an EG or LFO. I saw it mentioned on the Softube Modular site, and I got curious. I’m not sure quite what to do with it now that I built one. The basic idea seems to be an AR that’s synced to a beat, either tapped in or external. It has an internal clock that either free runs or syncs to some multiple of an external pulse and the envelope period is determined by the clock. The quantize input captures the incoming gate, but doesn’t start the envelope until the next period. Async mode is more like a traditional ASR although the rise and fall periods are still determined by the internal clock period. The user docs are pretty well done and explain its operation in enough detail that I was able to model it. They have some interesting suggestions for patching it to obtain complex rhythms.


I have seen it used mostly for really abstract IDM.

Here is a Mylar Melodies video, at around 12:30 minutes in he starts making crazy high-hat patterns with the PEG as a clock multiplier.

I think the quantized gate input is really intriguing personally.

1 Like