Update on scripting

SelectPreset works fine but there are a couple of things you have to be aware of

  1. The SelectPreset applies to something that recognizes presets, in particular you tried to select a preset in the MidiInBlock. You need to be selecting a preset in your VB3 block (presets are not the same as sending program changes via MIDI)

  2. Your synth has to be capable of responding to SelectPreset function. Many synth plugins don’t actually support it. The native instruments FM8 is an example of a synth that DOES support it and so the following code will work to change the preset in FM8. I just tested it.

  3. Note that I changed a couple of things: you do not need that long IF statement to test newValue. You can actually concatenate an integer value to a string and intToStr conversion will be done automatically. See my updated version below

var wVB3Knob : Widget
var wVB3Name : Widget
var FM8 : Block

On WidgetValueChange (newValue : double) from wVB3Knob
var i : integer

// newValue represents a value between 0.0 and 1.0
i = Floor(30.0*newValue)

SelectPreset(FM8, i)

SetWidgetLabel(wVB3Name, "Preset #" + i)

End

initialization
Print(“Ready”)
end

One question about the ToString functions:

How could we convert doubles/floats to strings? I can’t find a FloatToString function.

According to the manual Print and Notify both expect string parameters. Anyway I can write:

Print(parameterValue)

…but it won’t work with Notify:

Notify(parameterNumber)

What will work is (but I don’t like it :wink: ):

Notify("" + parameterNumber)

One more thing: I saw IntToString and BoolToString are deprecated. Is there a new way to do such conversions?

The reason I deprecated them was because you CAN always say “” + value where value is int or double or bool. If you think we should have explicit conversion functions then I can certainly undeprecate the other ones and add one for double

It’s not really important, I asked more out of interest which solution you’d recommend. I think it would be nice to have one more function for doubles to have them complete if someone prefers to use them. I’m also very okay with “” + value because…it works :slight_smile:

The if then block in my code will be used to display the name of the preset which I don’t believe the scripting language returns (yet). So when i==0, it will display “Wurlitzer” and for i==1 it will display “Suitcase” etc… (an an example)

So is there a list of types that are available in the language? I defined the plugin as a MidiInBlock which is obviously incorrect. Do I need to define a plugin via var, or is it implied when I give it a name?

Can you please elaborate further on your comment “Your synth has to be capable of responding to SelectPreset function.”. How is the script behaving differently to me left-clicking the preset on the plugin dialog window?

Has anyone suggested a new function that allows a plugin to load external FXB files?

Cheers guys - hopefully I’m not too much of a PITA.

If you’re talking about OUR dialog where we display presets exposed by a plugin, then SelectPreset works fine. However, (unfortunately), there are a lot of plugins out there that have their own “presets” but they don’t expose them to the host so we can’t see them. In that case, we have no way to change them via SelectPreset. You might still be able to change the preset using program change messages (which you would send to the MidiInBlock that’s connected to your synth, by the way)
“Can you please elaborate further on your comment “Your synth has to be capable of responding to SelectPreset function.”. How is the script behaving differently to me left-clicking the preset on the plugin dialog window”

No official list yet and in fact this stuff is still changing. If you want to refer to an arbitrary plugin block, then the type is “PluginBlock” (as of the release coming next, right now I think it’s still “AudioBlock”)
“So is there a list of types that are available in the language”

Interesting suggestion but I’m not sure it makes sense to support this. What’s the use case?
“Has anyone suggested a new function that allows a plugin to load external FXB files”

No, your feedback is extremely valuable and appreciated
“Cheers guys – hopefully I’m not too much of a PITA.”

Maybe this image helps @JellyDude72
Left plugin has NO GP exposed presets - right one, you can see GP presets!!

Exactly - and I presume that for the one on the right, you’re able to use SelectPreset?

The plugin I was using does have presets available as per your plugin on the right so maybe my script didn’t work because I defined the plugin pVB3 as the wrong type.

I’ll play again when I’m home this afternoon.

As an aside, VB3 is a 32-bit plugin so I assume you’re using some kind of bridge like 32-Lives.

I have no idea how well those things work in terms of exposing all the functionality of a VST.

@david Using your updated version - I get this error:

Semantic error: Line 9, Col 27: Identifier not declared: Preset

((but I’m fairly new to scripts)

VB3 is a 32bit plugin - I’m using jbridge. There could be an issue across that interface - I’ll play.

… although it works when left-clicking via the dialog window.

Am I supposed to guess what you have written on line 9?

You need to include your script if you want anyone to be able to help you!


Using your updated version – I get this error:

Semantic error: Line 9, Col 27: Identifier not declared: Preset

<var wVB3Knob : Widget
var wVB3Name : Widget
var FM8 : Block
On WidgetValueChange (newValue : double) from wVB3Knob
var i : integer
// newValue represents a value between 0.0 and 1.0
i = Floor(30.0*newValue)
SelectPreset(FM8, i)
SetWidgetLabel(wVB3Name, “Preset #” + i)
End
initialization
Print(“Ready”)
end>

You’re using the wrong quotes: You have to use “those” and not “those” for your string literals.

Replace that in the SetWidgetLabel line and the Print line and it will compile.

I tested your script. I will work with VB3 (at least on Windows), but it won’t work for FM8 because FM8 has its own preset management system and doesn’t expose those presets to the host. What you can do for a plugin like the KORG Wavestation VSTi is:

var wVB3Knob : Widget
var wVB3Name : Widget
//var FM8 : Block
var MidiIn : MidiInBlock
On WidgetValueChange (newValue : double) from wVB3Knob
var i : integer
programChangeMsg : programChangeMessage
// newValue represents a value between 0.0 and 1.0
i = Floor(30.0*newValue)
//SelectPreset(FM8, i)
programChangeMsg = MakeProgramChangeMessage(i)
SendNow(MidiIn, programChangeMsg)
SetWidgetLabel(wVB3Name, “Preset #” + i)
End
initialization
Print(“Ready”)
end

That does work for every instrument that supports program change messages - like Wavestation. Be aware that you need your MidiIn block to be activated for scripting, it needs to have the scripting name “MidiIn” and of course it has to be connected to the plugin. Unfortunately the FM8 doesn’t support any of those ideas so you won’t be able to select FM8 presets with GP scripting.

Thanks @jazz10 Lukas R, the above - “those” and not “those” correction its true! it does compiles!
Second method is also nice to have I guess :wink:

I have tried sending the program change message, but most of my plugins didn’t respond. I’ll need to do a combination of program change messages and setting presets.

I noticed in your example you defined (and commented out) FM8 as a Block. Where can I find a list of object types supported by GPScript?

Lukas, it works fine with FM8, in fact that’s where I did most of my testing.

See my blog article on configuring FM8 to respond to program changes. Once you do thst, presets work as well

https://www.gigperformer.com/rackspaces-vs-program-changes