fbpx
Skip to main content

MIDI Forum

Inserting XG/GS res...
 
Notifications
Clear all

Inserting XG/GS resets

5 Posts
3 Users
0 Reactions
6,207 Views
Jason
Posts: 441
Honorable Member
Topic starter
 

My midi instrument editor was cruising along for a while, but it has been slow going as of late. I have gone back to work, so I have less time to get fully immersed in working on it, plus I've run in to quite a few position tracking issues when writing out my edited files. I finally have most of them sorted out after weeks and weeks of troubleshooting, debugging, pulling my hair out, throwing my laptop in the ocean, and then finally having some flashes of brilliance to help me fix them. I am finally able to (as far as I can tell and have tested) insert program changes and bank selects and not cause any corruption to the MIDI files or cause any erroneous data from things being byte-shifted either too far or not far enough.

So, now that that's all settled, I'd like to revisit inserting some SYSEX resets. I originally planned a few months ago to allow changing any MIDI file type (GM, GS, XG) to any other, but found this to not be practical if, for example, you have a complex XG file with literally hundreds of SYSEX events. I had written code to REPLACE the initial SYSEX reset, so didn't need to worry about choosing placement or modifying delta times around it. It worked when there weren't other resets and things that cancelled it out. So I may keep that code, but I also need to know where I should INSERT a SYSEX reset if there is not one. Should I go for track 0? Or track 1? How much delta time do I need to have before/after a reset for it to be most compatible? And, as an example, say I need to insert it at 1 second's worth of delta time, would I then need to shift all other tracks starting time over a second as well? I can check my XG files for general "time spacing" between a GM reset and an XG reset (as they usually have both).

 
Posted : 14/08/2021 7:36 pm
Sema
 Sema
Posts: 184
Reputable Member
 

GM/GS/XG resets don't need timeout. You can put them on tick 0 in the same track where the other MIDI messages (e.g. NoteOn) go.

 
Posted : 15/08/2021 11:39 am
JohnG
Posts: 227
 

First of all, it doesn't really matter where you place your SysEx commands as they aren't channel messages, but the convention is to put them in the first channel.

The recommended practice is to allow a couple of hundred milliseconds after a GM system on SysEx and about 50 milliseconds after the XG on.
I recall reading this in one of Yamaha's XG specifications.
It may also be in one of the MIDI RP's.

JohnG.

 
Posted : 22/08/2021 7:56 am
Jason
Posts: 441
Honorable Member
Topic starter
 

I went on what you said and looked through some documents. Indeed XG says the system should allow 50 ms after an XG System On to respond. In the General MIDI Level 2 specs, it says 100 ms after a GM2 System On, but does not list any times for a GM System On or Off. I haven't found anything for GS yet.

Since I'll be using the GM2 System On SYSEX, I'll need to figure out how to add 100ms to that based on the file I'm editing, and 50ms for XG. I'll keep digging to see if I can find any GS.

 
Posted : 22/08/2021 4:36 pm
Jason
Posts: 441
Honorable Member
Topic starter
 

Roland documentation lists 50ms after every type of reset (GM1 On, GM2 On, GS Reset).
"* There must be an interval of at least 50 ms between this message and the next."

So it looks like 50ms, unless XG then 100ms.

Soooo, I don't actually do anything (yet) when I read the timing info from a MIDI file. How do I calculate 50ms and 100ms and convert it to delta time (assuming non-SMPTE timing)?

I know there are two bytes at the end of the header (tick/division) and then potentially an FF 51 (tempo) and/or FF 58 (time signature) in the first track. Currently I just read these bytes in to a throw-away variable.

 
Posted : 22/08/2021 7:01 pm
Share: