crossover_c_t

allocate 16bit table with cubic crossover shape in SDRAM memory, -128.00 .. 127.99
Author: Sputnki
License: BSD
Github: sptnk/table/crossover_c_t.axo

Inlets

None

Outlets

None

Attributes

combo size

spinner value

Declaration
static const uint32_t LENGTHPOW = (attr_size);
static const uint32_t LENGTH = (1 << attr_size);
static const uint32_t LENGTHMASK = ((1 << attr_size) - 1);
static const uint32_t BITS = 16;
static const uint32_t GAIN = 12;
int16_t *array;
Init
static int16_t _array[attr_poly][LENGTH] __attribute__((section(".sdram")));
array = &_array[parent->polyIndex][0];
{
  int i;
  for (i = 0; i < LENGTH; i++)
    array[i] = 0;
}

int i;
double d;
double x;
double range;

double g = attr_value; // this is the percent of gap
g = g * LENGTH / 200;

for (i = 0; i < LENGTH; i++) {
  x = i;
  x = (x - LENGTH / 2); // bonding the domain

  if (x <= -g) {
    d = g * g * (3 * x + 2 * g);
  } else if (x > -g && x <= g) {
    d = x * x * x;
  } else {
    d = g * g * (3 * x - 2 * g);
  }

  if (i == 0)
    range = -d;
  d = d * 32768 / range; // bonding the codomain
  array[i] = d;
}

Privacy

© 2024 Zrna Research