crossover_hard_t

allocate 16bit table with hard crossover shape in SDRAM memory, -128.00 .. 127.99
Author: Sputnki
License: BSD
Github: sptnk/table/crossover_hard_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: 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 = (x + g) * 1000 / (LENGTH / 2 - g);
  } else if (x >= g) {
    d = (x - g) * 1000 / (LENGTH / 2 - g);
  } else {
    d = -0;
  }

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

Privacy

© 2024 Zrna Research