## Random cheap sigmoid

DSP, Plug-in and Host development discussion.
Smashed Transistors
KVRist
141 posts since 10 Oct, 2014
martinvicanek,

The integro differential method is one of the older aliasing limiting technique. It's stunning that they published that as new stuff.

Anyway it works specifically like a charm with x/sqrt(x^2+1) as its integrand is simply sqrt(x^2+1).

I've implemented this scheme on the Axoloti and it is very efficient. On the little ARM STM32F4, the 1/x and sqrt float run in parallel with integer operations. Thus interleaving fixed point calculation leads to something efficient.

Code: Select all

``````int32_t outGain = param_OutGain<<3;
const int32_t *pIn = inlet_in;
int32_t *pOut = outlet_out - 1;
while(pOut < outlet_out + BUFSIZE - 1){
float r;
float y1 = y0;
y0 = arm::vsqrtf(arm::q_to_float(nextSq1, 22));
nextX0 = ___SMMUL(param_InGain, *pIn)<<7;     //execs in parallel
nextSq1 = ___SMMLA(nextX0, nextX0, 1<<22);
int32_t x1_x0 = x1 - x0;  // we avoid division by small values
if(abs(x1_x0) > (1<<17)){  //the divider is not too small
r = y1 - y0;           // go diff !
r /= arm::q_to_float(x1_x0, 27);
} else {  // it's too small use the direct value
r = arm::q_to_float(x0, 27) / y0;
}
x1 = x0;
x0 = nextX0;
pIn++;
pOut++;
*pOut = ___SMMUL(outGain, arm::float_to_q(r, 30));
}``````