A chunk header is its 4-byte type followed by its 4-byte length - eight bytes that tell you what the chunk is and how many bytes of body follow. Today you read both into one record.
Read an 8-byte chunk header into a value holding its type and length.
A chunk header is the fixed 8-byte preamble every chunk carries: the 4-byte
type you read yesterday, immediately followed by the 4-byte big-endian length you
read on the first day. The length counts only the bytes of the chunk’s body -
the data after the header - so MThd with length 6 means six more bytes follow,
and MTrk with length 20 means twenty.
Combine the two helpers you already have: readType on bytes 0..4 and readU32
on bytes 4..8. This little record is what lets you stride through a file one
chunk at a time, because once you know a chunk’s length you know exactly where the
next chunk begins.
type ChunkHeader struct {Type stringLength uint32}// reuse readType on the first 4 bytes and readU32 on the next 4func readChunkHeader(b []byte) ChunkHeader {// (fill in using readType and readU32)}