lorenz_osc

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

Inlets

bool32 active

bool32.rising reset

Outlets

frac32buffer.bipolar axis x

frac32buffer.bipolar axis y

frac32buffer.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;
Audio 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 = (int32_t)(x * (1 << 22));
  outlet_y = (int32_t)(y * (1 << 22));
  outlet_z = (int32_t)(z * (1 << 21));

}

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