Implementing an ADSR envelope in GLSL for totally non-conspicuous reasons…


@lritter I was using step to define regions before in a non-branching way though it was utterly unreadable. But I really like the min/max idea. Readable and concise.

@lritter also just noticed: my implementation can handle durations of 0 fine, while the min/max approach needs to use an eta to avoid division by zero

@Pixdigit with audio, you don't want zero sample gates anyway. it clicks.

and most of the time the parameters are constant, so that max is removed at compile time.

@lritter well sometimes with s=1. and an attack you might not want a decay. Arguably it's a niche case but I prefer it for being true to the arguments. Zero decay means zero decay.

I guess it's personal preference and it's not going to matter anytime soon.

Sign in to participate in the conversation
Layer8 in Space

Welcome to the 8th Layer of Madness

Most topics are related to Linux, Anime, Music, Software and maaaany more