Two How to Do Questions

Thanks, Paul. I will play with this code this evening … this should do the trick :slight_smile:

Your solution : "SetParameter(MIN, 288, newValue): works great! However, where does it say in the GP documentation the “288” is the “Note On property”?

If I say, “SetParameter(MIN, 1, newValue)”, it turns on channel 2 and sets its output channel to 16. … but where is the reference to this? :slight_smile:

The documentation does not say that 288 is note on, it says where you can see what parameter number a property has.
Each parameter goes from 0.0 to 1.0
So you have to calculate the right value to set a properties to the desired value.
It you should think about using widgets mapped to such properties and use variations.

1 Like

Upper left corner :wink:
All Blocks (plugins included) “reveal” their parameters there, when you edit/manipulate them

4 Likes

Can you tell me why this script doesn’t work? I am trying to set the MaxNote value to 60. It is my understanding that the Maxnote parameter in the MIDIBlock has a value of 17.

Var
M1 : MidiInBlock
nMaxNote : Integer
nMaxNoteValue : Integer

On Activate

nMaxNote = 17
nMaxNoteValue = 60
Print ("Activate - Setting MAX Note to 60")
SetParameter(M1, nMaxNote, nMaxNotevalue)

End

on NoteEvent(m : NoteMessage) from M1

Print ("NoteEvent - setting Max note to 15")
SetParameter(M1, nMaxNote, 15)

end

Parameter values must always be between 0.0 and 1.0 so a value of 15 makes no sense.

For MIDI note 15, you need the value 0.1181102

Now before you panic and wonder where the hell that number came from, there is a function called MidiToParam that converts MIDI values (i.e, integers between 0 and 127) into the appropriate parameter value between 0.0 and 1.0

So the following will work for you

SetParameter(M1, nMaxNote, MidiToParam(15))

will do the job

1 Like

By the way, if your goal is to set keyboard splits, it’s useful to define a function to make it easier to use those parameters. For example

Var
   Foo : MidiInBlock

Function DefineSplit(keyboard : MidiInBlock, lowerNote : integer, upperNote : integer)
   SetParameter(keyboard, 16, MidiToParam(lowerNote)) // 16 is parameter index for lower note
   SetParameter(keyboard, 17, MidiToParam(upperNote)) // 17 is parameter index for upper note
End


Initialization
   DefineSplit(Foo, C2, C3) // Create a split between C2 and C3
End

To declare a MidiInBlock , I would say for example "var M1 : MidiInBlock " where “M1” is the handle of the MidiInBlock. My question is: How do I declare a source block?

What do you mean by “source block”?

image

the handle is “Source2” and I want to do this: “SetPluginBypassed(Source2,1.0)”

I am getting this error: “Semantic error: Line 67, Col 27: Identifier not declared: Source2”

Ok, you miss this

var Source2 : PluginBlock

You have to declare this block

And then this should work:

SetPluginBypassed(Source2,true)

The 2nd parameter is a boolean and not a double.

1 Like

Thank you. I didn’t know the type “PluginBlock” as it doesn’t seem to be defined in the online documentation!

However, now this statement “SetPluginBypassed(Source2,1.0)” is getting the following error:
“Semantic error: Line 68, Col 35: Types are not compatible”

See my refreshed answer :wink:

And with the code helper button you get help

Yes, that works using “true” … but isn’t the value “1.0” the same as true and “0.00” the same as “false”?

No it is not.

Maybe technically in internal structures, but the compiler needs to know about the type.
What should the compiler do when you would use 0.5?

Boolean is clearly defined as true and false.

1 Like

Since I have your attention: is there is way to play a MIDI track to a source plugin?

You can use even external sequence like Cubase or Logic or BitWig or Ableton Live to do that.
Right now there is no Midi Player available within Gig performer.

But you could use a Midi player VST.

which midi player vsti do you recommend?

You can try this (is an entry in the forum)

Midi files player

1 Like

GP Script is not C (or Java or any other language that confuses Boolean with integers) :grinning:

2 Likes