COMP(avg);

HAL_PIN(in) = 0.0;
HAL_PIN(ac) = 0.01;
HAL_PIN(out) = 0.0;
HAL_PIN(absout) = 0.0;

MEM(float avg) = 0.0;
MEM(float absavg) = 0.0;

RT(
  float i = PIN(in);
  float ia = ABS(i);
  float a = PIN(ac);

  // avg
  avg = i * a + avg * (1 - a);
  absavg = ia * a + absavg * (1 - a);

  PIN(out) = avg;
  PIN(absout) = absavg;
);

ENDCOMP;
