The Sketch Pad is undoubtedly one the favorite features in GameSynth, allowing you to draw sounds with a mouse or a graphic tablet. From contact sounds to whooshes trajectories and particles movements, sound design becomes immediate and more creative, responding to each of your movements.
In version 2021.1, scripting was added to the Sketch Pad, opening new opportunities to control sounds by creating complex curves that are either too difficult to draw manually or require a lot of accuracy. Scripting also makes it possible to enter pressure information even without a graphic tablet.
Sketch Pad scripting works in all models. Here are some examples of scripts in action:
When clicking on the Script button under the Sketch Pad, you will be presented with the scripting editor. The upper part is where the code is to be written (the editor support syntax highlighting) and the lower part is where potential warnings or errors will be displayed.
The C# script code you write – or load – will be inserted in the body of a function. Therefore, any C# statement that can be written inside a function is valid. You can for example call the trigonometric functions of the Math namespace, as shown below.
This short code generates a Lissajous figure that would otherwise be hard to draw manually. The resulting curve is shown below in the Particles model. Notice how the pressure is gradually increasing over time, making the line thicker.
Scripts create curves by adding individual points – that will later be connected – with the AddPoint function. Calls to this function appear in red in the script to make them more obvious. The AddPoint function takes 4 arguments: the x and y positions of the point, the pressure applied when drawing, and finally a time stamp.
The valid range is [0…1] for the x, y, and pressure arguments. Values outside this range will be clipped by GameSynth. The time stamps are expressed in seconds and their valid range is [0…60]. If necessary, GameSynth will reorder the points to make sure the timestamps are increasing. It will also make sure the curve starts when the play button is pressed.
Sketch Pad scripting offers new ways to generate complex evolving sounds in GameSynth, and we are eager to see what you will create with it!