private void updateHeaders() { header.Length = this.bytes; byte[] dataHeader = header.GetBytes(); riff.Length = this.bytes + dataHeader.Length + waveFormat.Length; byte[] riffHeader = riff.GetBytes(); waveStream.Write(riffHeader, 0, riffHeader.Length); waveStream.Write(waveFormat, 0, waveFormat.Length); waveStream.Write(dataHeader, 0, dataHeader.Length); }