ADSR Tool

Info

This is a tool I built for music stuff but never used. Basically, it takes a waveform, and based on a volume envelope, repeats and applies said envelope. It's intended for single-period, loopable waveforms (e.g. a single iteration of a square wave, sine wave, etc.). This allows you to apply a volume envelope to them. 15 represents 100% volume, 0 represents 0%. For each number you enter, it repeats the loaded waveform at a lower volume. I was inspired by the volume envelopes possible with the NES.

The first field is a length multiplier, and the second field is the volume envelope.

For best effects, you should normalize your sample. Also, it simply loops on the last envelope value; I did not add a way to add an envelope loop marker. It wouldn't be hard to do, so if you actually find yourself using this and have a need for it, let me know.

The playback controls here are mostly for testing. There may be slight pitch shifts depending on your parameters. I believe this is because the AudioBufferSourceNode interface only lets you set loop points in seconds, rather than samples, and that the conversion can cause a rounding error or loss of precision.

Here's a sample wave you can use to mess around with it, though. This tool uses wavyjs. You should turn your volume down, as well.