Midi MetaMessages

Hi, I used SongMaster Pro to generate a midifile which contain one regular midi track with note-on and note-off messages as well as a ‘meta’ track with other messages like ‘set_tempo’, ‘marker’, and ‘cue_marker’.
If I view the midi file using the mido package in Python it looks like the following (truncated to a few lines of the ‘meta’ track only).
Input:
midi_file = mido.MidiFile(‘midifile.midi’)
midi_file.tracks
Output:
[MidiTrack([
MetaMessage(‘track_name’, name=‘meta’, time=0),
MetaMessage(‘key_signature’, key=‘B’, time=0),
MetaMessage(‘time_signature’, numerator=4, denominator=4, clocks_per_click=1, notated_32nd_notes_per_beat=96, time=0),
MetaMessage(‘set_tempo’, tempo=554376, time=0),
MetaMessage(‘marker’, text=‘Intro’, time=3800),
MetaMessage(‘set_tempo’, tempo=560181, time=3840),
MetaMessage(‘cue_marker’, text=‘Key change’, time=77),
MetaMessage(‘set_tempo’, tempo=557281, time=3763),

Dragging the midifile to the Midi Player in GP, both tracks can be seen. In the Midi Monitor however, I see only CC and NoteOn NoteOff messages, not the Tempo Changes and ‘marker’.
The ‘cue_marker’ metamessage represents the text strings in SongMaster in the “Notes-track” (could be used to indicate when a new section starts or, as in the example above, a key change). The ‘marker’ metamessage seem to represent the ‘Sections’ track in SongMaster (e.g. Intro, Verse, Chorus etc.).

My idea is to program a scriptlet with a callback (e.g. having the scriptlet sending a midi note-on message in response to a specific ‘cue-marker’ or ‘marker’ in the incoming midi metamessage). I am new to the GPScript and in my first attempt I can only get GPScript to respond to regular midi events such as note-on note-off etc, not the metamessages in the ‘meta’ track. However, I have seen that I can have the GP global tempo being adjusted from the tempo changes in the midifile.

My question is therefore, would it be possible to do this with GPScript?

I am by no means anything resembling an expert on this stuff, but as I understand it these “midi meta messages” are things that are defined for midi files but not for actual midi transmission.

In my very vague memories of how this works is that originally there was the midi spec, which defined the standard midi messages everyone knows and loves.

Then somebody wanted to expand on that to create files that contain streams of midi messages. In creating those “midi file” standards a number of things were added that do not actually correspond to midi messages that are transmitted over a midi interface. I believe these things that you are talking about fall into that category.

I think the purpose of such things originally was that you could have a piece of software, like an early DAW-type application, that would recognize things like key signatures and tempo changes so that it could display and act on them in the host program that was reading the midi file, but they are purely for the host, not for the midi transmission stream. In some very limited way it’s like an attempt at a standard file format for DAW files using exclusively note (as opposed to audio) data.

So I think there are really a couple different “issues” embedded in your question:

  1. can GP’s midi file player recognize those “meta messages” and/or act on them?
  2. can something be done in GPScript to act on them?

I don’t know the answer to either of those, but my guess is that it’s currently “no”. I could be wrong about that, though. If so, somebody will surely chime in.

As for whether they could be implemented in GP if they’re not already? Anything’s possible. I’m just not sure how many people would have a use for such a thing. I don’t know enough about the degree of standardization of such things or complexity of implementing them to really have an opinion.

Yes, that’s correct

Yes, that’s because the MIDI File Player is internally parsing certain meta events and responding to them appropriately.

Interesting. So a Tempo Change could potentially be picked up by a GPScript using an “OnTempoChange” callback, then communicate that (if necessary) to some external app via midi/OSC if there was reason to.

Constructing some kind of tighter interaction between SongMaster Pro and GP has been one of those ideas floating around in my head for a while, although I don’t have any particular need to fulfill. (I have used John’s video tutorial and the rackspace. In general I don’t, though.)

Truth is I really wish SongMaster Pro came in a VST form so I could just host it inside GP.

Ok, so the metamessages in the ‘meta’ track, although including timestamp data, is not transmitted from the midi-out connector of the midi file player? However, the meta info exists and to some extent is used internally by the Midi file player? Does this mean that GPScript is not going to work for this task?