/* * Converts the samples from bytes to doubles. This function is for use with 16bit samples. * Because we are working with 16bit samples there are two bytes for sample. Therefore we * convert two bytes into one double. * Returns the double array of converted values. */ public double[] dataToDouble() { handle = new Handler(); double[] result = new double[data.Length / 2]; for (int i = 0, pos = 0; pos < data.Length - 2; i++, pos++) { result[i] = handle.byteToDouble(data[pos], data[++pos]); //make method static } return result; }