Random cheap sigmoid

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

Post Thu Mar 21, 2019 3:07 pm

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));
}
See you here and there... Youtube, Google Play, SoundCloud...

martinvicanek
KVRer
27 posts since 16 Mar, 2014

Re: Random cheap sigmoid

Post Thu Mar 21, 2019 4:51 pm

You dont even need to worry about division if you rewrite
(sqrt(1 + x^2) - sqrt(1+ x1^2))/(x - x1) = (x + x1)/(sqrt(1 + x^2) + sqrt(1 + x1^2))
:wink:

User avatar
Smashed Transistors
KVRist
141 posts since 10 Oct, 2014

Re: Random cheap sigmoid

Post Sat Mar 23, 2019 3:57 am

Wow, that's a kind of magic !
See you here and there... Youtube, Google Play, SoundCloud...

Return to “DSP and Plug-in Development”