private void readAudioDescriptionChunk(BinaryReader source) { double sampleRate = StreamUtils.DecodeBEDouble(source.ReadBytes(8)); // aka frames per second string formatId = Utils.Latin1Encoding.GetString(source.ReadBytes(4)); uint formatFlags = StreamUtils.DecodeBEUInt32(source.ReadBytes(4)); uint bytesPerPacket = StreamUtils.DecodeBEUInt32(source.ReadBytes(4)); uint framesPerPacket = StreamUtils.DecodeBEUInt32(source.ReadBytes(4)); channelsPerFrame = StreamUtils.DecodeBEUInt32(source.ReadBytes(4)); uint bitsPerChannel = StreamUtils.DecodeBEUInt32(source.ReadBytes(4)); this.sampleRate = (uint)Math.Round(sampleRate); // Compute audio duration if (bytesPerPacket > 0) { double secondsPerPacket = framesPerPacket / sampleRate; secondsPerByte = secondsPerPacket / bytesPerPacket; // Duration will be determined using the size of 'data' chunk } else { secondsPerByte = 0; isVbr = true; // Duration will be dertermiend using data from the 'pakt' chunk } // Determine audio properties according to the format ID codecFamily = AudioDataIOFactory.CF_LOSSY; switch (formatId) { case ("lpcm"): case ("alac"): codecFamily = AudioDataIOFactory.CF_LOSSLESS; break; } // Determine format if (formatsMapping.ContainsKey(formatId)) { containeeAudioFormat = formatsMapping[formatId]; } else { containeeAudioFormat = formatsMapping["none"]; } }