Desperately Seeking: Efficient modulation depth

    Apr 23 2006 | 9:18 pm
    An LFO puts out a signal between 1 and -1. If the desired output shall oscillate between 2 and 0.5, I input my mod depth as 2
    So to set the modulation depth (d) of the modulating signal (m) I use
    output=input.(m to the power of d)
    Is there a more efficient way of doing this ? pow~ is hardly a processor friendly method :-)
    Stuart Grimshaw

    • Apr 24 2006 | 3:40 am
      mul and add? like lfo~ -> *~ 0.75 (to make the range 1.5) -> +~ 1.25
      Jonathan Segel 4014 Brookdale Ave. Oakland, CA 94619
    • Apr 24 2006 | 5:14 am
      Do you want a wave that spends as much time between 0.5 and 1 as it does between 1-2 (implying an exponential distortion) or do you want a wave that is simply balanced between 0.5 and 2 (with a center of 1.25)
      If it's the latter, I have an abstraction, PM.Scale~, that does this with matrix~ which is very fast. If it's the former, you could try doing a lookup table. In all likelihood, there's not going to be that many log scales that you'd need (especially if it's just for an lfo) and the difference between them will eventually be negligible given enough samples. Store the log scales in a buffer, and use the exponent to set the offset into the buffer~. (use a phasor~ to drive a wave~ for this, and have the offset points pass through a sah~ so you only grab a new offset at the beginning of the cycle)
      Alternately, if pow~ is too expensive, you could try putting it in a poly~, downsampling it n times, and then using rampsmooth~ on the output.
      Peter McCulloch
    • Apr 24 2006 | 8:19 am
      I forgot to add that when the LFO outputs zero, then I need a value of 1. So I guess it's the exponential that I'm after (anyone know a site for people who haven't even thought about maths for twenty five years ?).
      I had already considered the wave~ lookup solution, maybe even the 2dwave~, which is a bit above me but I might as well get stuck into it now.
      Thanks for the suggestions.