I got a question for the calc geeks here: Suppose the first derivative and second derivative of a continous CV signal (lfo … whatever) F(t) = x are of musical interest to me, perhaps for coupling the direction and acceleration of the signal to modulation parameters accordingly.
How would I get dF/dt(t) and d^2F/dt(t) in real time and as smooth as the original signal? Are there modules doing this out of the box? Any ideas how to cobble together a patch doing it?
I don’t know of an existing module that does it but a C++ module could work something like this (not tested yet, might contain some embarrassing mistakes) :
Thank you! I got an idea what a difference quotient is, but I n ever looked into Prototype in detail until now.
(:
I’d write something like F(block.inputs[i][block.bufferSize])-F(block.inputs[i][0])/block.bufferSize no?
So why don’t we have modules simulating analog derviation/integration? Are they just boring or useless? I would imagine the opposite, if you put them in series or feed them back on themselves. (:
Maybe it hasn’t been a popular thing to try because the numeric range of the derivative can vary so wildly. For example, it’s well known that sin(x) just becomes cos(x), but sin(x * 440.0) becomes 440.0 * cos(x * 440.0)! So it would be hard to scale the output of the module to the allowed or useful voltage range.
Yes, most integrator/differentiator “modules” in 1950’s analog computers included a calibrated scale knob/multiswitch. For musical purposes, you’d just need a knob with a wide exponential range.
Yes actually spot on. The notion of trying this in rack occured to me browsing through a signal processing book from the fifties. ((: The idea of using analog differentiator circuits as lego blocks to model all sorts of (differential) equations is appealing. It’s awfully closely related to what we play with here, yet we don’t use those simple thingies directly.
So I typed the line of code @Vortico suggested into a .js file just to see what happens. And yah, if I feed a sine lfo into it and observe the output through scope it doesn’t too far off from a cosine …if I multiply Andrews formula by 40000000. lol. Forgive me if this is a stupid question to ask but I don’t understand what I need to do to clean this up a little.
Prototype examples and the thread dedicated to it here help a little, but it’s still a bit fumbling in the dark. Here’s the script, its testament to my ineptness so pls bear with me. (:
Yenakios got it right. First derivative is something like ‘direction’ and speed the original signal is going, second is the ‘acceleration’ change of velocity of the signal in this direction. I hope at least for closely related but distinct control signals to create movement with a organic feel when mapped to different parameters of the same sound.
A sawtooth vco is an integrator that takes the pitch constant and turns it into a ramp (sort of). So at it’s simplest, the derivative would be the reverse of that.