pouët.net

Synthbench by Fugue [web]

Synthbench, written by Greg "fugue" Santucci
--------------------------------------------

Synthbench now features a scripting interface which enables you to specify
an arbitrary waveform for generator and controller nodes, as well as
explore procedural music generation.

Contact thecodewitch@gmail.com if you have any comments or questions.


Synthbench Lua Commands
-----------------------

In the console, Ctrl-Enter enters the command. Enter by itself adds a line.

"play()"
Resumes simulation of the bench and playback.

"pause()"
Pauses simulation of the bench and playback.

"about()"
Prints some version information about Synthbench.

"setWaveform(ElementID, NumSamples)"
If ElementID refers to a Lua generator or controller element, this will set its
writable waveform using the output of wavefn(t). If ElementID does not refer to
a Lua generator or controller element, nothing happens.

"getTrackerNote(NotePosition, TrackID)"
Returns a NoteNumber, OctaveNumber pair to describe the note at NotePosition, TrackID in the tracker.

"setTrackerNote(NotePosition, TrackID, NoteNumber, OctaveNumber)"
Sets the note in the tracker at position NotePosition, TrackID to NoteNumber, OctaveNumber.

"getNumNoteSamples()"
Returns the duration of a tracker note in terms of number of samples.

"setNumNoteSamples(NumSamples)"
Sets the duration of a tracker note in terms of number of samples. There are 44,100 samples each second.

"getNumElements()"
Returns the number of elements currently on the bench.

"getElementType(ElementID)"
Returns a number indicating the type of the element referred to by ElementID.
The meaning of the number is as follows:
0:    SineGenerator
1:    SineController
2:    SquareGenerator
3:    SquareController
4:    SawtoothGenerator
5:    SawtoothController
6:    TriangleGenerator
7:    TriangleController
8:    NoiseGenerator
9:    NoiseController
10:   LuaGenerator
11:   LuaController
12:   LowPassFilter
13:   BandPassFilter
14:   HighPassFilter
15:   Delay
16:   Music
17:   Output

"getElementPosition(ElementID)"
Returns a pair of numbers specifying the coordinates of the element referred to by ElementID.

"setElementPosition(ElementID, x, y)"
Sets the coordinates of the element referred to by the ElementID.

"autoJoinElement(ElementID)"
Automatically joins this element to the other elements based on its surroundings.

"assignTracksToElement(ElementID, Track1On, Track2On, Track3On, Track4On)"
Activates the respective track for the music element referred to by ElementID.
If ElementID does not refer to a music element, nothing happens.

"getTrackAssignmentsForElement(ElementID)"
Returns 4 values specifying whether or not the music element referred to by ElementID plays that track.

"addSineGenElement(x,y)"
"addSineConElement(x,y)"
"addSquareGenElement(x,y)"
"addSquareConElement(x,y)"
"addLuaGenElement(x,y)"
"addLuaConElement(x,y)"
"addDelayElement(x,y)"
"addLPFElement(x,y)"
"addHPFElement(x,y)"
"addBPFElement(x,y)"
"addMusicElement(x,y)"
Adds the element of the respective type to the bench at the specified coordinates. This function
returns the ID of the element it just added, which can be used in other functions which expects an
ElementID.

"clearBench()"
Clears the bench of all elements.

"getElementParameter(ElementID, paramID)"
Returns the current setting of an element parameter.

"setElementParameter(ElementID, paramID, paramVal)"
Sets the current setting of an element parameter.

"getSelectedElement()"
Returns the ElementID of the currently selected element

"setSelectedElement(ElementID)"
Selects the element referred to by ElementID

"setCameraPosition(x,y)"
Sets the coordinates of the center of the screen.

"getCameraPosition()"
Returns the coordinates of the center of the screen.

"setViewportSize(size)"
Specifies the size of the viewport. A larger size zooms out the view.

"getViewportSize()"
Returns the size of the viewport.

"setSplitterSizes(controlsSize, waveformSize, benchSize, consoleSize)"
Specifies the relative sizes of the 4 panes of the Synthbench GUI.

"getSplitterSizes()"
Returns 4 values indicating the current sizes of the 4 panes of the Synthbench GUI.


Synthbench Lua Callbacks
------------------------

wavefn(x)
This function is called by setWaveform to describe the waveform to be written to a lua generator or lua controller element.
The range of parameter t is from 0 to 2*pi, and wavefn needs to be defined for this range.
The NumSamples parameter of setWaveform will specify the number of steps used to vary t from 0 to 2*pi.
Internally, Synthbench will linearly interpolate for values in between.

sbUpdate(t)
This function is called approximately 20 times a second, and allows you to specify actions to take over time.
The parameter t specifies the number of seconds elapsed since the program started, excluding periods that simulation/playback was paused.

sbNoteUpdate(t)
This function is called after every note is played by the tracker. This enables the modification of tracker data to be synchronised with
tracker playback.