SetChannel problem

Hi,

  1. note = MakeNoteMessageEx(C3, 100, 3)
    Print(“Test SetChannel(3):” + note)
    works as expected ( c3 velocity100 MidiCh 2 on log screen)

but:

  1. On NoteOnEvent(note : NoteMessage) from SL_Mk2_In
    SetChannel(note, 2)

Print(“Test SetChannel(2):” + note) ( c3 velocity100 MidiCh 1 on log screen)

(The SL is sending on MIDI channel 1)

SetChannel(note, 2) does not change the Midi channel it is still channel 1

  1. note = MakeNoteMessageEx(C3, 100, 0)
    SetChannel(note, 2) does not change the Midi channel it is still channel 1

Is it a bug or what could be my misunderstanding?
Please help.

Peter

Hmm, I don’t think SetChannel works any more. You should use WithChannel. Unfortunately, it’s a bit messy as WithChannel returns a MidiMessage which is not assignment compatible with a NoteMessage so you have to write something like the following:

On NoteEvent(note : NoteMessage) from Keyboard
    var m : MidiMessage
    

    m = note.WithChannel(3)
    
    // Do something with m
End

Also, in GP Script, channels go from 1 to 16 so

MakeNoteMessageEx(C3, 100, 0)

is wrong, that 0 should be a 1

Thank you David,
will change my code to WithChannel.

Peter

Not at all. Your feedback is much appreciated — GP Script is still a work in progress - I have to rethink that particular function so that it can be generic.