Van der Pol oscillator

A classical example of a nonlinear oscillator. As r increases, the timbre becomes progressively richer, but the period increases, making the synth out of tune.

Log in to post a comment.

input.r = 0.1; // min=-0, max=5, step=0.01

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


vanDerPol.play(c3);
vanDerPol.play(c4);
vanDerPol.play(e4);
vanDerPol.play(g4);