Is there a preferred location for a SYSEX reset in a MIDI file? I have code that will convert a GM System ON to a GS reset. However, if there isn't a GM System ON, it... doesn't do anything because there's nothing to convert. So I am working on adding a GS reset if no GM is present. I'd like to put it in the "correct" spot. From a few files I've just checked, it looks like it typically comes immediately after the tempo. Is this a correct assumption? Or is there a better/more general spot to put it?
It resets all parameters, so it should come before any other message sent to the device. It does not really matter whether it comes before or after some meta message.
So in practive, make it the first message. (This also makes it easier to find it for programs that try to determine the GM/GS/XG dialect.)
Only the GM reset sets everything back to the MIDI default settings.
It is advisable that every file should have one and it should be set at 01:1:000.
As it can take a short fraction of a second to implement, the GS (or XG) reset should be placed maybe half a beat later, e.g. 01:1:240 at 480 TPQN.
This is how all the professionally authored files from Yamaha are set up.
[quotePost id=15891]Only the GM reset sets everything back to the MIDI default settings.
It is advisable that every file should have one and it should be set at 01:1:000.
As it can take a short fraction of a second to implement, the GS (or XG) reset should be placed maybe half a beat later, e.g. 01:1:240 at 480 TPQN.
This is how all the professionally authored files from Yamaha are set up.[/quotePost]
The XG files that I have all have both a GM and XG SYSEX. I actually hadn't realized that many (but not all) of my GS files also contain both, because my code for displaying numbers of SYSEX commands for GM was restricted to a single Device ID, which I only just recently discovered. I hadn't actually loaded up any GS files since then. So I have been REPLACING the GM SYSEX in a GM file with a GS SYSEX Reset. Doh.
I've updated my code, so now I add the GS Reset after the GM ON instead of replacing it, or add both at the very beginning of the first track if neither exists. This only happens if the user chooses to convert to GS.
Per a previous thread ...
https://midi.org/forum/10424-calculating-millisecond-time-from-delta-time
... I am currently not going to worry about the time between the GM ON and GS Reset, as the complexity increases immensely.
For my current project that I am using this for, one of my final steps is running the file through Cakewalk, which ends up spacing out events anyways.
I may also have to figure out a way to add the GM ON in to the soundtrack I've already completed, because Cakewalk did not add those in. I have previously completed all the GS files by replacing the GM ON.