FractalRingSgnX

FractalRing. 8x oversampling with triangular window decimation.
Author: Smashed Transistors
License: LGPL
Github: tiar/dist/FractalRingSgnX.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);
}

outlet_out = inlet_x >= 0 ? a : -a;

Privacy

© 2024 Zrna Research