One problem I’ve discovered: Looping stops if the decay time is turned up beyond some point
I was able to diagnose the reason:
Here’s a scope picture at a fairly fast decay time, triggered by the comparator when the envelope falls below threshold:
The yellow trace is the envelope. It’s decaying slowly at the start and then the next attack begins. Purple is the comparator output, low when the envelope is above threshold and high when it’s below. Cyan trace is the trigger pulse made from the rising edge of the comparator.
That rising edge is slow, much slower than the falling edge. So the trigger is relatively wide and not that high.
Here it is with a longer decay time:
Now the rising edge is slower, so the trigger is wider and shorter. (And there’s a longer delay between the trigger and the start of the next attack, for some reason.) At some point the rising edge becomes so slow the trigger becomes too small to trigger the 555 and looping stops.
Seems the op amp does not swing abruptly when the input crosses threshold slowly.
[Well, of course it doesn’t. What does an op amp do? It takes the difference between the two inputs and multiplies it by a huge gain, maybe 100,000. So if the inputs differ by +1 V it outputs about +100,000 V — except it can’t, it can only go up to the power rail, in this case +12 V. Likewise if the inputs differ by -1 V it outputs -12 V. But if the inputs differ by anything less than 12 V / 100,000 it won’t go to the rail, it’ll really put out the difference times the gain. In that range the output follows the shape of the input. And if the decay time is long enough, then getting from -0.00012 to +0.00012 V on the input, or -12 to +12 V on the output, will take enough time that the trigger height will be suppressed.]
So… based on some breadboard work, I tried bumping up the capacitor in the rising edge to trigger section from 1 nF to 10 nF. That makes the trigger bigger. And… it works! Now it loops through the whole range of decay times (up to about 40 seconds).