read interp

read from table, linear interpolated
Author: Johannes Taelman
License: BSD
Github: table/read interp.axo

IO Variants: 2


Variant: 1

Inlets

frac32buffer.positive index in fraction of table size

Outlets

frac32buffer table[a]

Attributes

objref table

Audio Rate
uint32_t asat = __USAT(inlet_a, 27);
int index = asat >> (27 - attr_table.LENGTHPOW);
int32_t y1 = attr_table.array[index] << attr_table.GAIN;
int32_t y2 = attr_table.array[(index + 1) & attr_table.LENGTHMASK]
             << attr_table.GAIN;
int frac = (asat - (index << (27 - attr_table.LENGTHPOW)))
           << (attr_table.LENGTHPOW + 3);
int32_t rr;
rr = ___SMMUL(y1, (1 << 30) - frac);
rr = ___SMMLA(y2, frac, rr);
outlet_o = rr << 2;

Variant: 2

Inlets

frac32.positive index in fraction of table size

Outlets

frac32 table[a]

Attributes

objref table

Control Rate
uint32_t asat = __USAT(inlet_a, 27);
int index = asat >> (27 - attr_table.LENGTHPOW);
int32_t y1 = attr_table.array[index] << attr_table.GAIN;
int32_t y2 = attr_table.array[(index + 1) & attr_table.LENGTHMASK]
             << attr_table.GAIN;
int frac = (asat - (index << (27 - attr_table.LENGTHPOW)))
           << (attr_table.LENGTHPOW + 3);
int32_t rr;
rr = ___SMMUL(y1, (1 << 30) - frac);
rr = ___SMMLA(y2, frac, rr);
outlet_o = rr << 2;

Privacy

© 2024 Zrna Research