fac
Joined: Dec 08, 2007 Posts: 162 Location: Mexico
G2 patch files: 1

Posted: Thu Mar 27, 2008 12:58 pm Post subject:
Function orbit generator Subject description: or: how to do feedback loops in control signals 


Ok, so I want to dwelve into generative/algorithmic sequences, and one of the things I want to do is to compute the orbit of a function f(x).
Given a function f(x), the orbit around point x[0] is the sequence x[0], x[1], ... where x[i+1] = f(x[i]).
So, the idea is to have a control value X, perform some operations on it, and then update X with the result of those operations. This process is repeated (with each new value of X) but in a controlled manner; that is, one has to be able to say when the new value must be computed (e.g., with a clock or trigger sequencer).
As a first example, I tried to make a simple counter. Suppose that f(x) = x + 1, then the sequence starting at 0 would be 0, 1, 2, etc.
After a few failed experiments, I came up with this patch:
The idea is this: I need to manipulate control signals, but I don't want them to be constantly updated. The only modules that I found that could transfer control signals in a clocked manner were the MIDI CC IN/OUT modules. In the second column, from top to bottom, there's a MIDI CC IN module which outputs the "current" value for X. That value is processed with whatever function we want (in this case f(x) = x + 1), and then, both the "old" and the "new" value are sent to a switch. The switch is controlled by a very short Hold envelope  the idea here is to constantly send the "old" value, until the envelope is triggered, then the new value is sent, but for a very brief time, just enough for the MIDI CC OUT module to send the value back to the MIDI CC IN on top. I added a manual "reset" mechanism that forces X to be replaced with a default value (zero, in this case). Of course, this could also be controlled automatically (e.g., reset every 16 or 32 steps).
I also added an ADC module just for display purposes. When you run the patch, you can see ADC counting in binary from zero to 127, and then stops (I guess the Level Add module doesn't fold over), that's where the reset mechanism becomes useful.
What I really want to do is some fractal sequences; for example, the mandelbrot fractal is given by the function f(x) = x^2 + c, where c is a given constant (you get a different sequence for each value of c). In this case, x is a complex number, but all the required operations are sums and products, which should be easy to do with the Level Multiplier and the mixers.
So, what do you guys think? Someone has probably done all this before, I just want to know if there could be a better way to do this.
Description: 

Download 
Filename: 
function_orbit.pch2 
Filesize: 
1.26 KB 
Downloaded: 
1234 Time(s) 

