crossover_p_t

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

Inlets

None

Outlets

None

Attributes

spinner value

combo size

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: edit this if you want (0-100)

g = g * LENGTH / 200;

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

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

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

Privacy

© 2024 Zrna Research