log2

logarithm, y=16+8*log2(x) Version 2: When the math/log from the factory library is set to zero it sends out -64 value. Which is prbably the right number but in some cases it is unwanted, so I made this version which when set to zero actualt sends out zero.
Author: Johannes Taelman - Edited by Jaffasplaffa
License: BSD
Github: jaffa/math/log2.axo

Inlets

frac32.positive input

Outlets

frac32 output

Declaration
int32_t equalOO;
int32_t LOGARITHMIC;
Control Rate
Float_t f;
f.f = inlet_a;
int32_t r1 = ((f.parts.exponent & 0x7F) - 18) << 24;
int32_t r3 = logt[f.parts.mantissa >> 15] << 10;
LOGARITHMIC = r1 + r3;

// Turns the loga signal off when 0. Fix the problem //

equalOO = inlet_a == 0;

outlet_o = (equalOO) ? 0 : LOGARITHMIC;

Privacy

© 2024 Zrna Research