mididi.writer

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

Members

Functions

writeHeaderChunk
void writeHeaderChunk(T output, HeaderChunk chunk)
writeMIDI
void writeMIDI(T output, MIDI midi)

writeMIDI encodes a MIDI data object (mididi.types.MIDI) to binary data.

writeMIDIFile
void writeMIDIFile(File file, MIDI midi)
void writeMIDIFile(string path, MIDI midi)

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
void writeTrackChunk(T output, TrackChunk chunk)

writeTrackChunk encodes a track chunk to bytes and puts them into output.

writeTrackEvent
void writeTrackEvent(T output, TrackEvent event, ubyte runningStatus)

writeTrackEvent encodes a single track event to binary data and puts it into output.

Structs

DelegateSink
struct DelegateSink

A utility output range that outputs bytes to a delegate.

Meta