Thomas' attractor

Thomas' cyclically symmetric attractor. Play with the slider for some weird noises.

Log in to post a comment.

/*

Thomas' cyclically symmetric attractor

In the dynamical systems theory, Thomas' cyclically symmetric attractor
is a 3D strange attractor originally proposed by René Thomas.[1]
It has a simple form which is cyclically symmetric in the x,y, 
and z variables and can be viewed as the trajectory of a frictionally
dampened particle moving in a 3D lattice of forces.[2] The simple form 
has made it a popular example. 

https://en.wikipedia.org/wiki/Thomas%27_cyclically_symmetric_attractor

*/


input.b = 0.3; // min=0.01, max=0.33, step=0.001

const cyclAttractor = synth.def( class {
    constructor(options) {
        this.x = 0;
        this.y = 0;
        this.z = 0;
        this.a0 = 2 * Math.PI * midi_to_hz(options.note) * ditty.dt;
    }
    process(note,env,tick,options) {
        this.x += this.a0 * (Math.sin(this.y) - input.b * this.x) + 1e-6*Math.random();
        this.y += this.a0 * (Math.sin(this.z) - input.b * this.y);
        this.z += this.a0 * (Math.sin(this.x) - input.b * this.z);
        return [this.x, this.y];
    }
}, {env:one, amp:0.1});

cyclAttractor.play(c6);