lorenz_lfo

Lorenz chaotic attractor - lfo https://en.wikipedia.org/wiki/Lorenz_system
Author: JLS
License: BSD
Github: jls/lfo/lorenz_lfo.axo

Inlets

bool32 active

bool32.rising reset

Outlets

frac32.bipolar axis x

frac32.bipolar axis y

frac32.bipolar axis z

Declaration
float x;
float tx;
float y;
float ty;
float z;
float tz;
float s;
float r;
float b;
float dt;
int res;
Init
x = 0.1;
y = 0.1;
z = 0.1;
s = 10.0;
r = 28.0;
b = 2.66;
dt = 0.005;
res = 0;
Control Rate
if (inlet_active > 0) {

  tx = s * (y - x);
  ty = (r * x) - y - (x * z);
  tz = (x * y) - (b * z);

  x = x + tx * dt;
  y = y + ty * dt;
  z = z + tz * dt;

  outlet_x = (0.7 * x * (1 << 23));
  outlet_y = (y * (1 << 22));
  outlet_z = (0.6 * z * (1 << 22));

}

else {

  outlet_x = 0;
  outlet_y = 0;
  outlet_z = 0;
}

if ((inlet_reset > 0) && !res) {

  res = 1;
  x = 0.1;
  y = 0.1;
  z = 0.1;

} else if (!(inlet_reset > 0))
  res = 0;

Privacy

© 2024 Zrna Research