vsariola / sointu

Fork of 4klang that can target 386, amd64 and WebAssembly. Tools run on Windows, Mac & Linux
MIT License
262 stars 17 forks source link

wish: free envelope #179

Open wayfu opened 2 weeks ago

wayfu commented 2 weeks ago

a simple x/y field with a length parameter and 2+ nodes (one at time 0, one at time 1)- with more nodes addable.

vsariola commented 2 weeks ago

We discussed this with qm210 and the more universal unit (& easier to implement) might be "lookup table": you would draw a linearly interpolated curve with arbitrary number of XY points. You could then make a normal envelope with practically infinite attack and sustain at 0.5, so it effectively goes from 1 -> 0.5 (sustain) -> 0. Then just draw the lookup table shape to whatever you want to happen during decay and during release.

vsariola commented 2 weeks ago

Such a LUT would also be useful for arbitrary waveshaping & distortion

wayfu commented 2 weeks ago

i don't think i understand completely... isn't the arbitrary number of XY points exactly what i was describing?

vsariola commented 2 weeks ago

Yes, but instead of envelope, it would take take signal as input and treat it as a mapping. So, instead of just outputting envelopes, it could take any signal e.g. oscillator or envelope as its input. If the input to the unit is signal x, it would output f(x), where f is a piecewise linear function.

You could then input time into it (from an envelope) to get what you want. But you could also input an oscillator to it and e.g. use it to squash the peaks of an oscillator for distortion.