Here's a multi mode AD envelope generator built using an AVR. I used an ATTiny85, but the ATTiny45 should work just fine as well.
I'll post a Zip archive for anyone that wants to take a look at the code. The code function here destroys text formatting.
This program is written in C, and will drop right in to AVR Studio. I have extensively commented throughout, so it should be quite easy to follow.
This envelope generator has 3 modes available via a rotary switch:
Simple gated mode: Press the switch, and the attack cycle starts, release the switch, and the decay cycle will start.
Discrete triggered mode: Press the switch, and the attack cycle runs fully and holds at MAX. Press again, and the decay cycle will run fully and hold at its minimum.
Looping mode: Press the switch to enable or disable the LFO. Both attack and decay knobs will control the speed and waveshape.
The output is PWM, and can be run through a LPF, or LED, or whatever for interfacing with your circuit.
Fastest attack/decay time is around 65ms, or 15Hz-ish. Slowest is around 0.06Hz, so 16-ish seconds.
Here's a schematic:

Here's a simple VCA circuit to show the use of the AD generator:

This isn't a ready made stompbox per se, but it will showcase the functions of the AD.
Here's a link to an archive of the two schematics and the code for the project:
https://drive.google.com/file/d/0BzdyH8_QSjbXMkpzNzc3bkxtdW8/view?usp=sharingAs an aside, this code contains what I consider to be the "Cadillac" of debouncing routines. Anyone having trouble with debouncing should check this out for that reason alone.
I've seen a number of simple debouncing routines posted here using hardcoded delays. This is fine assuming your processor has nothing else to do, and you can waste millions of cycles in delays. Unfortunately, it's a pain if you want to perform other functions, or debounce multiple switches.
This debouncing code is from Peter Dannegger at AVRFreaks. A credit and link to his article is included in the code.
It's based on the vertical counter concept, and is capable of debouncing 8 switches independantly. It also works symetrically, so both on and off transitions are covered. It's small, fast and pretty much bullet proof.
Anyways, I hope you guys enjoy this little program, and find some fun ways to use it, or improve it. If you have any comments, or suggestions, I'd love to hear them.
Thanks!
