arcsin_t

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

Inlets

None

Outlets

None

Attributes

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;
for (i = 0; i < LENGTH; i++) {
  x = i;
  x = (x * 2 / LENGTH - 1); // bonding the domain from [-1,1] to [0,length]
  d = x + (x * x * x) / 6 + (x * x * x * x * x) * 3 / 40 +
      (x * x * x * x * x * x * x) * 5 / 112 +
      (x * x * x * x * x * x * x * x * x) * 35 / 1152 +
      (x * x * x * x * x * x * x * x * x * x * x) * 63 / 2816 +
      (x * x * x * x * x * x * x * x * x * x * x * x * x) * 231 / 13312 +
      (x * x * x * x * x * x * x * x * x * x * x * x * x * x * x) * 143 /
          10240 +
      (x * x * x * x * x * x * x * x * x * x * x * x * x * x * x * x * x) *
          6435 / 557056 +
      (x * x * x * x * x * x * x * x * x * x * x * x * x * x * x * x * x * x *
       x) *
          12155 / 1245184; // actual taylor polynomial
  d = d * 65536 /
      3.1415; // bonding the codomain from [-pi/2,pi/2] to [-2^15,2^15]
  array[i] = d;
}

array[0] = -32768; // correcting the "extreme" terms, since taylor series does
                   // not get them quite right
array[LENGTH] = 32768;

Privacy

© 2024 Zrna Research