How to Detect Song Select Message in Scriplet

Hi,

I’m trying to write a scriplet that will pass or block Song Select messages while passing anything else.

Since there is no callback for SongSelectMessage, I presumably will have to check the msg as returned by On MidiEvent(msg : MidiMessage).

What do I check for? IOW, what would be the actual code for pseudocode:

if (msg = SongSelect ) then

The Callback for Song Select is:

On Song(oldSongIndex : integer, newSongIndex : integer)
// Called when you switch to another song
End

Why ?

The op is talking about a specific MIDI message called Song Select – he is not referring to the Gig Performer concept of responding to changing the current song.

1 Like

I guess (that’s the only thing i can do here) it is about using the midi file player, since his other questions also were related to that topic.
@progster: Maybe a little more information of what you are about to do (and how) would be very helpful to understand your question and maybe also to help you with that…

I want to be able to embed the SS message in MIDI files, but then have widget/script control over whether it passes or not when the files are played.

I first thought to use the MIDI Filter block, but Song Select filtering is not offered there. (Would be nice if it was.)

Is there some technical complication to the concept of if (msg = SongSelect ) ?

And what will you do with that message?

Command downstream gear (software and hardware that responds to SS) to reconfigure.

IOW, the MIDI file would contain it’s own configuration commands, but I want to be able to squelch them at will.

If you’re going to insert messages in your MIDI file, why don’t you just insert a CC message with some unused number, detect that in your scriptlet and then GENERATE a SongSelect message if you want it.

1 Like

Hi. Interesting suggestion, which I had not thought of.

Issues and possible issues:

Files created with a custom-purpose CC whose intent is actually SongSelect would not be fit-for-purpose outside of the GP environment. Files created with actual SS message would still do their intended thing even outside of GP.

The presumably “dedicated” custom-purpose CC could be in conflict with other uses of that CC which are already in the file, or desired in the future.

The use of actual SongSelect in file is self-documenting. Use of a custom-purpose CC is not.

This list is not necessarily exhaustive .

If I may ask from this side -

Is there any way in which GP providing a SongSelectEvent() callback is a non-trivial thing to implement?

Is there today a way to do actual code for the pseudocode of: if (msg = SongSelect )

If not, would that be a non-trivial thing to implement?

Thanks.

Well, I was trying to give you short term solution until there can be proper support for SS

Use a format 1 file instead of a format 0 file and put the message in its own track. Then you can ignore that track in other systems.

All the above said, frankly, I don’t understand the issue. If you have a scriptlet that contains the following:

On MidiEvent(m : MidiMessage)
    if GetByte(m, 0) == 0xF3 // Song select 
       then Print( GetByte(m, 1)) // Song select number
    end    
End

then a song select message from a MIDI file will be recognized.

2 Likes

Cool, appreciated!

Super! Thanks very much.