double sum = 0; for (var i = 0; i < _buffer.length; i = i + 2) { double sample = BitConverter.ToInt16(_buffer, i) / 32768.0; sum += (sample * sample); } double rms = Math.Sqrt(sum / (_buffer.length / 2)); var decibel = 20 * Math.Log10(rms);