ApplyNoiseToAudio.AudioManager.DoubleToShort C# (CSharp) Method

DoubleToShort() public method

public DoubleToShort ( double array ) : System.Int16[]
array double
return System.Int16[]
        public Int16[] DoubleToShort(double[] array)
        {
            Int16[] output = new short[array.Length];

            for (int i = 0; i < array.Length; ++i)
            {
                output[i] = Convert.ToInt16(array[i] * 32767); //Int16 goes from -2^(N-1) to 2^(N-1)-1
            }

            return output;
        }