Midi message by SongPart

Hello,
I try to understand GP scripting, but… well i don’t.
I 'm trying to send a midi message when I activate a song part.
Song part 1: Midi message 1
Song part 2: Midi message 2
Song part 3: Midi message 3 ect…

(I know there is a fonction for that, but i want it to be by default, and the same for every song) I want to use it to light up Leds to know which song part i’m at without looking my computer screen.

I wrote that, but… i don’t really know what i’m doing.

var SongPartNumber : Integer

On Songpart(oldSongpartIndex : Integer, newSongpartIndex : Integer)
SongPartNumber = GetCurrentSongPart()
End
On Songpart(oldSongpartIndex : Integer, newSongpartIndex : Integer)
if SongPartNumber = 1
then MakeControlChangeMessageEx(1, 127, 3)
End

Why do you need scripting? Why can’t you just configure the first song part of a song to send a message?

Then export that song to file so you can use it as a template for all your other songs and the first song part will have the MIDI message in it.

Yes thay a solution for New songs

But i already have 50+ songs.
It means i need to enter manualy each midi messages to Every song variation.
(My midi messages are 1 for the light on and 9 to turn off Any other lights)
And if i change midi contrôler. I need to start all over again.
I think it would Take me hours to do that.
That’s the reson why i was looking into GP scripts

OK, what exact message have to be sent when a song is changed?

You can try this Gig Script

// Called when you switch to another songpart
var mm : NoteMessage
On Songpart(oldSongpartIndex : integer, newSongpartIndex : integer)
 if newSongpartIndex == 0 then
  mm = MakeNoteMessage(65, 100)
  SendNowToMidiOutDevice("IAC-Treiber Bus 2", mm)
  mm = MakeNoteMessage(65, 0)
  SendNowToMidiOutDevice("IAC-Treiber Bus 2", mm)
 end 
End

You have to give your present physical MIDI Output Port and the desired note number

Hmm, be very careful using IAC ports - make sure there’s no MIDI In Omni plugin or you will get feedback

Therefore I wrote that the present physical device has to be used.

1 Like

Hello, sorry for the late answer. I used your code @pianopaul. and it’s perfect. Exactly what i needed.
I used it on a few rehearsal and it’s flawless. Thank a lot.

The actual code for my use:

// Called when you switch to another songpart
var mm : ControlChangeMessage
On Songpart(oldSongpartIndex : integer, newSongpartIndex : integer)
if newSongpartIndex == 0 then
mm = MakeControlChangeMessageEx(11,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

if newSongpartIndex == 1 then
mm = MakeControlChangeMessageEx(11,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

if newSongpartIndex == 2 then
mm = MakeControlChangeMessageEx(11,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

if newSongpartIndex == 3 then
mm = MakeControlChangeMessageEx(11,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

if newSongpartIndex == 4 then

mm = MakeControlChangeMessageEx(11,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

if newSongpartIndex == 5 then
mm = MakeControlChangeMessageEx(11,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

if newSongpartIndex == 6 then
mm = MakeControlChangeMessageEx(11,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

if newSongpartIndex == 7 then

mm = MakeControlChangeMessageEx(11,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

if newSongpartIndex == 8 then

mm = MakeControlChangeMessageEx(11,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

 if newSongpartIndex == 9 then

mm = MakeControlChangeMessageEx(11,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(12,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(13,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(14,127,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
mm = MakeControlChangeMessageEx(15,0,2)
SendNowToMidiOutDevice(“OpenDeck | pico”, mm)
end

End

1 Like