chua_osc

Chua chaotic oscillator https://en.wikipedia.org/wiki/Chua%27s_circuit
Author: JLS
License: BSD
Github: jls/osc/chua_osc.axo

Inlets

bool32.rising reset

bool32 active

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 h;
float alpha;
float beta;
float a;
float b;
float dt;
int res;
Init
x = 0.5;
y = 0.25;
z = 0.125;
h = 0;
alpha = 15.6;
beta = 28.58;
a = -1.14286;
b = -0.714286;
dt = 0.005;
res = 0;
Audio Rate
if (inlet_active > 0) {

  h = (b * x) + (0.5 * (a - b) * (fabs(x + 1) - fabs(x - 1)));

  tx = alpha * (y - x - h);
  ty = x - y + z;
  tz = -beta * y;

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

  outlet_x = (int32_t)(x * (1 << 25));
  outlet_y = (int32_t)(y * (1 << 28));
  outlet_z = (int32_t)(z * (1 << 25));

}

else {

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

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

  res = 1;
  x = 0.5;
  y = 0.25;
  z = 0.125;
  h = 0;

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

Privacy

© 2024 Zrna Research