writeMIDI encodes a MIDI data object (mididi.types.MIDI) to binary data.
writeMIDIFile essentially does the same as writeMIDI to a range object that writes to a std.stdio.File, but it is given for convenience.
writeTrackChunk encodes a track chunk to bytes and puts them into output.
writeTrackEvent encodes a single track event to binary data and puts it into output.
A utility output range that outputs bytes to a delegate.
mididi.writer contains functions for encoding MIDI objects to raw bytes.
Currently, the writer is compatible with the standard MIDI format 1.0 and forward compatible with newer formats (in which case newer features will be ignored, as the specification demands).
The implementation (and some of the documentation) is based on this specification: https://www.cs.cmu.edu/~music/cmsip/readings/Standard-MIDI-file-format-updated.pdf
Note: these functions do not always check if the provided data (i.e. the chunks and track events) is actually correct, but if the data comes from MIDIReader functions, it should always be complete and valid data