FractalRing

FractalRing. 8x oversampling with triangular window decimation.
Author: Smashed Transistors
License: LGPL
Github: tiar/dist/FractalRing.axo

Inlets

frac32buffer.bipolar x

frac32buffer.bipolar y

Outlets

frac32buffer out

Declaration
int32_t na, x, y;
int32_t f(int32_t x, int32_t y) { return (x ^ (y >> 1)) & (y ^ (x >> 1)); }
Init
na = x = y = 0;
Audio Rate
// 8x oversampling with triangular window decimation
int32_t dx = (abs(inlet_x) - x) / 8;
int32_t dy = (abs(inlet_y) - y) / 8;
int32_t a;
{
  x += dx;
  y += dy;
  int32_t z = f(x, y);
  a = ___SMMLA((8 << 25), z, na);
  na = ___SMMUL((1 << 25), z);
}
{
  x += dx;
  y += dy;
  int32_t z = f(x, y);
  a = ___SMMLA((7 << 25), z, a);
  na = ___SMMLA((2 << 25), z, na);
}
{
  x += dx;
  y += dy;
  int32_t z = f(x, y);
  a = ___SMMLA((6 << 25), z, a);
  na = ___SMMLA((3 << 25), z, na);
}
{
  x += dx;
  y += dy;
  int32_t z = f(x, y);
  a = ___SMMLA((5 << 25), z, a);
  na = ___SMMLA((4 << 25), z, na);
}
{
  x += dx;
  y += dy;
  int32_t z = f(x, y);
  a = ___SMMLA((4 << 25), z, a);
  na = ___SMMLA((5 << 25), z, na);
}
{
  x += dx;
  y += dy;
  int32_t z = f(x, y);
  a = ___SMMLA((3 << 25), z, a);
  na = ___SMMLA((6 << 25), z, na);
}
{
  x += dx;
  y += dy;
  int32_t z = f(x, y);
  a = ___SMMLA((2 << 25), z, a);
  na = ___SMMLA((7 << 25), z, na);
}
{
  x += dx;
  y += dy;
  int32_t z = f(x, y);
  a = ___SMMLA((1 << 25), z, a);
  na = ___SMMLA((8 << 25), z, na);
}

int sx = inlet_x >= 0 ? 1 : -1;
int sy = inlet_y >= 0 ? 1 : -1;
outlet_out = a * sx * sy;

Privacy

© 2024 Zrna Research