What’s the best strategy for making a flattened sine wave? If I were running this at audio rate, I’d just run a sine through some kind of distortion, but I’m looking to use this for control rate, so that doesn’t seem like the right approach here. The idea is for the signal to ramp up to a value in a sine-like fashion, then sit there for awhile, then ramp back down to a minimum value, sit there, and ramp back up. The whole process happens very slowly - over the course of several minutes or longer - and then repeats.
Hm, distortion is just a math formula – standard waveshaping based on tanh, x / (1 + abs(x)) (the latter is SC’s distort unary op), or any other transfer function will produce the same shape at any calculation rate. I think there’s no logical basis to say that it doesn’t seem right (particularly if the upper and lower values are unchanging).
That suggests an envelope. If you check the documentation for Env.new, you’ll find possible curve shapes:
\sine or \sin: sinusoidal S shaped segments.
\welch or \wel: sinusoidal segments shaped like the sides of a Welch window.
Which will also work in DemandEnvGen as well (though here the curve shape must be given as 3 for \sine and 4 for \welch).