... local a, b, c in mytable ...which reads the fields "a", "b" and "c" from "mytable" and makes them local variables.
vprint(str)
verror(str)
escape(str)
unescape(str)
To (re-)define a callback, just define a function with the right name. For example, to add a frame callback, add the following to your script:function onFrameCb()Note: callbacks are actually wrapped in the file lua/callback_wrappers.lua which does various bits of magic to simplify things.... do something ...end
onFrameCb()
midiEventCb(midiEvent)
sysexCb(sysex)
resetCb()
networkReceiveCb()
messageCb(name, msg)
saveProgramCb()
loadProgramCb()
initCb()
openCb()
closeCb()
keyCb(key)
dragCb(drag)
helpCb()
setParameterCb(par, value)
valueChangedCb(control, value, str)
getHostTime()
setHostTime()
getCycle()
getTimeUs()
getBarStart()
getVSTParameter(par)
setVSTParameter(par, value)
sendMidi(event)
function midiEventCb(event) sendMidi(event) end
sendSysex(sysex)
networkReceiveLoop(udp)
getInstances()
sendToInstance(name, msg)
toOSC(table)
{oscaddress, {value1, value2, value3...}}toOSC("/test/message", {1, "hello", true}) is valid, for example.
{timetag, {oscaddr1, {val1, val2, val3...}}, {oscaddr2, {val1, val2, val3...}},...}You can nest bundles if you wish. If you want to specify types other than float, integer, string and bool you can explicitly set the type. To do this, instead of passing a bare value, pass a table, where the first element is the type name, and the second is the value. For example:
toOSC("/test/message", {{"float", 1.0}, {"rgbacolor", 2113140}, {"blob", "someblobtext"}}Valid values for the type are:
fromOSC(string, fulltypes=false)
guiAddControl(control)
menu_items = {'One', {'Two', {'Two.sub1', 'Two.sub2, {'Two.sub3', {'Two.sub3.sub1','Two.sub3.sub2'}}}}, 'Three'}defines a menu like:
guiGetSize()
guiSetSize(size)
guiSetValue(control, value)
guiGetValue(control)
guiSetLabel(control, string, highlighted)
openFileSelector(pattern="*.*", func=nil)
reset(scriptName)
getVSTPath()
VSTFrameLength
VSTSampleRate
ScriptName
VSTFrameStartUs
VSTProgramName
GUISizes
GUISizes[GUITypes.knob]returns the size of the knob component.
Additional table entries in midi events.
noteToNumber(noteSpec)
numberToNote(number)
copyMidiEvent(event)
completeMidiFields(event)
sysexMsg(sysex)
noteOn(note,vel,channel, delta=0)
noteOff(note,channel, delta=0)
setCC(controller,value,channel, delta=0)
programChange(program,channel, delta=0)
pitchBend(bend, channel, delta=0)
channelAftertouch(aftertouch, channel, delta=0)
polyAftertouch(note, aftertouch, channel, delta=0)
midiEventToString(event)
panic()
stopAllPlaying()
addMidiFilter(filter)
--convert cc1 to pitchbend addMidiFilter{type=midi.cc, controller=1, callback = function(event) event.type = midi.pb event.bend = event.velocity * 127 sendMidi(event) end}
--transpose notes from 40--60 down by a fifth addMidiFilter{type={midi.noteOn,midi.noteOff}, byte2="40-60", callback = function(event) event.byte2= event.byte2-7 sendMidi(event) end}
inputNotesDown
outputNotesDown
inputCC
outputCC
noteNames
plainNoteNames
plainNoteNumbers
noteNumbers
midi
midiTypeNames
midicc
scheduleEvent(event)
addControl(constructor)
interval
dimIntervals
augIntervals
chords
modes
scales
print()
print_table(table, [printer])
t = reverseMapping(q)
str = serializeTable(t, name)
t = {1, 2, "hello", {4, 5, 6}} str = serializeTable(t, "newTable") (loadstring(str))() --restore the table print_table(newTable) --prints the restored table
help
help.name="Transpose" help.description="Simple MIDI transpose. Transposes everything up by 1 semitone" help.author="tzec"
length,beatIndex,timeToBeat = computeBeatTime(samplePos, tempo, sampleRate, beatFraction)
class ADSR
key_name(key)
virtualkeys
programData
savePersistentProgramData
loadPersistentProgramData
globalPersistence
loadGlobalPersistence
saveGlobalPersistence
sysexToTable(dump)
hexToSysex(specifier)
hexToSysex(0xf0, 0x41, 0xf7) hexToSysex("F041F7") hexToSysex("F041", 31, 32, "F7") hexToSysex("F041", {31, 32} "F7") hexToSysex("F041", {31, "BD091A", 32} "F7")
sysexToHex(dump)
setSharedMemAlias(name)
sharedMemAliases
sharedMemReverseAliases
sendMidiToInstance(name)
executeTrap.limit
executeTrap.frameLimit
createPartialCoroutine(func, instructions)
function do_something() for i=1,1000000 do vprint(i.."\n") end end z = createPartialCoroutine(do_something, 1000) z() --executes 1000 instructions worth of func z() --executes another 1000 instructions worth of func
createTimedPartialCoroutine(func, ms, resolution = 500)