Spectral scripting, Addspectralscript( name, function ), Copybin( from, to ) – Expert Sleepers Spectral Conquest v1.0.0 User Manual

Page 17: Multiplybin( index, multiplier )

Advertising
background image

Spectral Scripting

The scripts that are available via the ‘Script’ controls as described above are defined in ex-
actly the same way as the MIDI/OSC scripts. Please review the ‘MIDI & OSC Scripting
Manual’ for details.

In addition to the functions defined for MIDI control, Spectral Conquest defines the fol-
lowing functions for writing scripts to process the spectrum.

addSpectralScript( name, function )

This is the main function that lets you add a new script to the range available. Simply call
it in the main body of your Lua file.

E.g.

local function scriptedShift( state )

-- etc.

end
addSpectralScript( "Shift", scriptedShift )

The first argument is the name of the script to display in the plug-in GUI. The second is
the function to process the spectrum.

The function passed to addSpectralScript() should accept one argument, which is a state
table, used to pass various information from the plug-in to the script. The members of the
state table are:

state.maxBin - the maximum bin index i.e. the bins are numbered from 0 to state.maxBin.
state.param1/2/3/4 - the four parameter values as set by the GUI.

A complete function might look like this (which is the plug-in’s built-in Low Pass Filter
script):

local function scriptedBrickWallLPF( state )

local maxBin = state.maxBin

local cutoff = state.param2 * maxBin

local setBin = setBin

for i=cutoff,maxBin,1 do

setBin( i, 0, 0 )

end

end

copyBin( from, to )

Copies the value of bin index ‘from’ to bin index ‘to’.

multiplyBin( index, multiplier )

Multiplies the value of bin ‘index’ by ‘multiplier’.

Advertising