Hey hey,
I have an issue with exponents. I'm working on an envelope. It works by linearly transforming a phasor signal. To achieve different curve shapes I use an exponent. Consider this code:
kExponent init 16 ; the curve shape, 1 is linear
aPhasor = phasor:a(2) ; the phasor, statically at 2Hz here
aPhasor = aPhasor^kExponent ; this results in a quiet output between 1/3 and
; 1/4 of what it should be
kEnv = linlin:k(k(aPhasor), 1, 0) ; the linear transform, it's a downward
; curve
;kEnv = kEnv^kExponent ; this works much better, although the exponents must
; be the other way round, so kExponent = 16
aOut = oscil:a(kEnv, 330) ; just to test
outs(aOut, aOut)
This is a minimal example, so there are good reasons for aPhasor instead of kPhasor.
In this example kEnv^kExponent works, but for more complex envelope shapes that don't always rise and fall between 0 and 1, this will not work. It would change the value ranges.
The question is: why does it make such a big difference? The phasor moves between 0 and 1. 1^x = 1, never mind what x is. 0^x should also always be 0, if one excludes x=0 so 0^0. This is excluded! It's as if the phasor won't exactly start at 0, thus linlin can never produce the exactly value of 1.
Does anyone have a different solution? logcurve and expcurve will work on k-rate signals, so they could be applied to the k-rate envelope output, but again they would change the value ranges and it would mean creating a completely different method for an a-rate envelope.
Any thoughts or hints are welcome!
Best wishes,
Jeanette