The MIDI file is created in RAM, not on disk. You will subsequently use MIDISetEvent() to add tracks/events to the MIDI file, and then eventually use MIDISaveFile() to save the file to disk.
When a MIDI file is initially created in RAM, it has no tracks or events in it.
You may pass a second arg to MIDIOpenFile() to specify your desired resolution, either in pulses per quarter note (PPQN) or SMPTE frame rate. If you do not specify this arg, then MIDIOpenFile() assumes 96 PPQN resolution.
For example, here we create a MIDI file with 96 PPQN resolution and check if it successfully creates in RAM. If not, we display the error message:
err = MIDIOpenFile() IF err \== "" THEN SAY "ERROR creating new MIDI file:" errHere we create a MIDI file with 384 PPQN resolution:
err = MIDIOpenFile(, 384) IF err \== "" THEN SAY "ERROR creating new MIDI file:" errIf specifying a SMPTE frame rate, then the second arg will be two numbers. The first number will be -24, -25, -29, or -30, corresponding to the 4 SMPTE standards representing frames per second. The second number (a positive number) is the resolution within a frame (ie, subframe). Typical values may be 4 (MIDI Time Code), 8, 10, 80 (SMPTE bit resolution), or 100.
Here we create a MIDI file with 24 frames per second and 80 subframes:
err = MIDIOpenFile(, -24 80) IF err \== "" THEN SAY "ERROR creating new MIDI file:" errYou should check the return string from MIDIOpenFile(). If you attempt to call certain other RxMIDI functions before MIDIOpenFile() has been called successfully, then a SYNTAX condition will be raised.