public static float vibration(float x,float totalLength,float A,float B,float C,float D){
  x*=totalLength;
  return (float)(A * Math.exp(-B * x) * Math.sin(C * x + D));
}

public static float vibration ( float x , float totalLength , float A , float B , float C , float D ) { x *= totalLength ; return ( float ) ( A * Math . exp ( - B * x ) * Math . sin ( C * x + D ) ) ; }
notice that x is in ( 0 , 1 ] . should firstly , x = totallength * x . then get y = a * e ^ ( - b * x ) * sin ( c * x + d ) .
