This test demonstrates header chunk writing.
import mididi.def : TrackFormat; auto chunk = HeaderChunk( TrackFormat.sequential, ushort.max, TimeDivision.fromFormat1(-25, 64), ); auto result = ""; auto range = DelegateSink((scope const bytes) { result ~= bytes; }); range.writeHeaderChunk(chunk); assert(result == [ 'M', 'T', 'h', 'd', // chunk: header 0, 0, 0, 6, // length: 6 0, 2, // format: 2 0xFF, 0xFF, // nTracks: ushort.max 0b1_1100111, 64, // division: format 1; -25; 64 ]);