seg16disc

Author: Smashed Transistors
License: LGPL
Github: tiar/kfunc/seg16disc.axo

Inlets

frac32 in

frac32 offset

Outlets

frac32 out

Attributes

text values

Declaration
float vf[32] = {attr_values};
int32_t *v = (int32_t *)vf;
Init
for (int i = 0; i < 32; i += 2) {
  v[i + 1] = arm::float_to_q(vf[i + 1] - vf[i], 22); // dv q28
  v[i] = arm::float_to_q(vf[i], 21);                 // v q27
}
Control Rate
int32_t in = (inlet_in + inlet_offset) & 0x07FFFFFF;
//                 q23->q31        remove sign
int32_t a = (in << (31 - (27 - 4))) & 0x7FFFFFFF; // q31
int i = in >> (27 - 4);                           //[0..15]
i <<= 1;                                          //[0..30] by 2 step
//                     q28   q31  q27
outlet_out = ___SMMLA(v[i + 1], a, v[i]);

Privacy

© 2024 Zrna Research