Table of contents
Basic Synth Example

This Basic Synth example can be found in the Examples folder of the Gorilla Engine SDK. This is a great starting point for anyone new to Gorilla Engine because it showcases basic priciples that can be applied to all products developed with the SDK.
This example demonstrates:
- How to use the analog oscillator in Gorilla Editor.
- How to combine modules in Gorilla Editor to create a signal path.
- How GorillaScript creates instrument properties that can be exposed to your user interface (UI).
Basic Synth - Example Details
Note: The following is not intended to be a step-by-step guide on how to design a synthesizer. Instead we want to give you some insight into what makes the Basic Synth example tick. If you are not familiar with Gorilla Editor, here is a short introduction video. We also provide documentation for Gorilla Editor, Gorilla Script, Gorilla Tester and Gorilla Compiler.
Once the instrument file (Basic Synth.inst) is loaded, your Gorilla Editor should look like this:

If you can’t see all the modules on in the top left tree view (Module Tree), click the arrowhead icons to expand groups, mod sources, filters and effect busses. The same can be done in the bottom left tree view (Mapping Tree) to select the single sample used in this example. All elements you see in the module tree (top left), come with Gorilla Editor and can be added by right-clicking the instrument module at the very top, or the group named “saw osc”, or one of the mod sources, filters or the effect bus.
How you combine the different groups, filter, effects, oscillators, mod routings and scripts is up to you and the product you want to design. For detailed information about the modules that Gorilla Editor provides, take a look at our Gorilla Editor Module Reference.
Basic Synth Script (Script Module)
This example has a single script module named Basic Synth Script. This is where you create the unique sound design of a product as well as specific properties, that can be exposed to the final GUI. When opening this script (e.g. in Sublime or another code editor of your choice), you will find all the parameters avaliable in the final example.
This is the most relevant and interesting part of the Basic Synth example. So let’s take a closer look.
Pro Tip: Install the GorillaScript Syntax Highlighting to improve your experience when working with GorillaScript.
Basic Synth Script - Details
The following lines of code find themself between on init and on end. This means they are executed right away when the script is loaded.
Stepped Properties
In this case we want to create a control, that allows us to choose between two steps. Either Poly or Mono.
prop_stepped Mode
add_step(Mode, "Poly")
add_step(Mode, "Mono")
set_prop_param(Mode, PROP_GROUP, "Osc")
Line 1: Creates a stepped property, and gives it the name Mode. Line 2: Adds a step to this Mode property, that is named Poly. Line 3: Adds a step to this Mode property, that is named Mono. Line 4: Set one of the other available parameters of Mode - in this case the name of the group it shares with other parameters. Other parameters include the display name, or units to show after the value such as Hz or sec.
prop_stepped Octave = 2
add_step(Octave, "-2")
add_step(Octave, "-1")
add_step(Octave, " 0")
add_step(Octave, "+1")
add_step(Octave, "+2")
set_prop_param(Octave, PROP_GROUP, "Osc")
The only difference between this property named Octave is, that it as a few more steps and in the first line we used = 2 behind the property name, to choose a default step. Here, the second step (counting from zero) which is 0.
Exponential Properties
Now we want to create a control, that allows us to smoothly control a certain range. For this we used an exponential property, which is usually the most sensible way to control times, rates and frequencies.
prop_exp LFO_Rate(1000000, 10, 100000) = 694589
set_prop_param(LFO_Rate, PROP_UNITS, "Hz")
set_prop_param(LFO_Rate, PROP_GROUP, "Osc")
Pro Tip:Gorilla Script works with integer values, so in some places high values are used (1000 or 1000000 times the actual value) to ensure there is enough fine resolution when editing.
Line 1: Creates an exponential property named LFO_Rate. It has a maximum value of 1000000, the lowest displayed value is 10/1000 and the highest displayed value is 100000/1000. We set the property to have a devault value of 694589/1000 which translates to 7Hz. Line 2: Sets the Hz parameter of the LFO_Rate property. Line 3: Sets the Osc parameter of the LFO_Rate property.
Pro Tip: Our Gorilla Engine Script Reference document has futher details on all available script properties.
Linear Properties
Next we will use a linear script property, to create a control for the gilde of our example. In Gorilla Editor we created this glide by:
A) Enabeling Glide in the instrument module. B) Adding a custom envelope. C) Creating one mod routing to control the intensity of the envelope with the glide amount, and another one so the envelope modifies the pitch..

prop_linear Glide_Time(0, 127, 1)
set_prop_param(Glide_Time, PROP_GROUP, "Osc")
Line 1: Creates a property with a linear scaling, named Glide_Time. It has a minimum value of 0 a maximum of 127. In this case we created no specific default value, so the default value will be 0. The property value gets divided by the last argument (1) and results in the value that will be displayed on the GUI. Line 2: Sets the Osc parameter of the Glide_Time property.
Boolean Properties
When scrolling to the bottom of our module tree (top left tree view) in Gorilla Editor, you will find an effect bus with a Chorus effect added to it. Now we’ll use a Boolean property, that allow switch that Chorus effect on and off.
prop_boolean Chorus
This single line creates a switch, named Chorus.
Volume Property
This code example creates a property for the overall volume a for this example, and its dB range.
prop_decibels Volume(1000000, 12)
set_prop_param(Volume, PROP_MIDI_CC, 7)
Line 1: Declares a property named Volume, which has its value display in decibels. By default the min value is 0 and we set a max of 1000000. This matches the range of many parameters in Gorilla Engine modules, including volume controls. The on our UI visible db maximum is set to 12. This means, if our value is turned up to max, our UI will display +12dB. Line 2: Creates a parameter, that assigns the property Volume to MIDI CC 7.
Now that we used Gorilla Script, to create controls and properties for our UI, let’s take a look at how to make them control the parameters of the Gorilla Editor modules.
Connecting Script properties to Gorilla Editor module parameters
At this point you should understand, how Gorilla Script creates the properties we want to end up in our Basic Synth example. Now let’s take a look at how to make them control parameters of different Gorilla Editor modules.
on Mode
set_module_param(M_GROUP, 0, 0, 8, Mode) 'select Voice Group
end on
A section of the script starting with on ... and ending with end on is known as a callback. In this case on Mode relates to the stepped property prop_stepped Mode mentioned here. So every time prop_stepped Mode changes, this callback kicks in.
Line 1: Starts a callback for the property named Mode. Line 2: Sets parameter 8 in the Gorilla Editor module Group 0 (in Gorilla Editor it’s named Group 0 - saw osc), to the value Mode. Line 3: Ends the callback.
To get the script command of any Gorilla Editor module parameter, just click the parameter in Gorilla Editor and press cmd+shift+c on your keyboard, or go to Edit>Copy Script Command. 
The other callbacks of the Basic Synth example work the same way. If you’re interested how the creation of a user interface works, take a look at the Introduction to UI Development and our JavaScript/YAML API reference.