code: public static float smoothPulse(float a1, float a2, float b1, float b2, float x) {
  		if (x < a1 || x >= b2)
  			return 0;
  		if (x >= a2) {
  			if (x < b1)
  				return 1.0f;
  			x = (x - b1) / (b2 - b1);
  			return 1.0f - (x*x * (3.0f - 2.0f*x));
  		}
  		x = (x - a1) / (a2 - a1);
  		return x*x * (3.0f - 2.0f*x);
  	}
docs: A smoothed pulse function. A cubic function is used to smooth the step between two thresholds.
  @param a1 the lower threshold position for the start of the pulse
  @param a2 the upper threshold position for the start of the pulse
  @param b1 the lower threshold position for the end of the pulse
  @param b2 the upper threshold position for the end of the pulse
  @param x the input parameter
  @return the output value