Create MIDI File

This is an example that generates a sixteenth-note rhythm, formats the information as MIDI note messages with midiformat, and stores them in a seq object, which can be saved as a MIDI file with the write message. 

Poly-rhythm generator

To create a poly-rhythm generator, this example chooses a division and articulates every attack point of that division. Use a metro synched to the transport to specify the divisions (or the tempo object, if preferred), and then use a counter (or a % object with the output of tempo) to specify the articulation points.

Iterate through Polyphonic MIDI files as simultaneous chords with detonate

Load a MIDI file into detonate, send it a “start” message, then send it “next” messages to output each note. Notice that the leftmost outlet sends out the delta time (in ms) until the next note in the score; that value can be tested, and if it’s sufficiently small, say under 50 ms for example, that means that the next note is practically simultaneous with the current one. The example then sends an additional ‘next’ message.

detonate demo

For producing a score out of time and then saving as a standard MIDI file, detonate is the best way to go, and it can save in either format 0 or format 1. Admittedly, you could save a format 0 MIDI file with text and seq by writing the text file, reading it back into seq, then writing that as MIDI, and it could all happen in a few milliseconds.