Lua for Interactive Actions
Lua is an amazing language to create interactive events. You can read its 88 pages manual on English here or in Portuguese here.
I am not present the language here, there are a lot of tutorials on the internet and YouTube.
- Very Complete here.
- Very Fast, Complex but yet Complete tutorial here.
- If you know how to program in another language here.
- Text here.
What I will present is how to create these actions using lua and oscofo, pd and max module.
oscofo Lua Module
oscofo Lua ModuleThe oscofo module inside Lua can be used to get and set values of oscofo on the fly. It exposes several functions:
oscofo.getKappainput: No input.output: Value of Kappa \(\kappa\).description: Get the value for Kappa. The closer it is to 10, the more synchronized the algorithm and the performance are.
oscofo.getBPMinput: No input.output: Value of the current BPM;description: Get the current BPM.
oscofo.getPitchProbinput: Frequency value in Hz, for exampleoscofo.getPitchProb(440)will return the probability of the pitch 440Hz being played.output: Value of the probability.description: Get the probability of being a specified pitch using the pitch templates.
oscofo.getSpectrumPowerinput: No input.output: Value of the probability.description: Returns a table with the current FFT magnitude of all the bins.
pd Lua Module
pd Lua ModuleThe pd module inside Lua allows interaction with Pure Data functionalities, exposing the following functions:
pd.printinput: A string message to print.output: no output.description: Logs a message to the console, similar to Pure Data'sprintobject.
pd.postinput: A string message to post.output: no output.description: Posts a message at the default verbosity level, used for general logging.
pd.errorinput: A string error message.output: no output.description: Logs an error message in the Pure Data console, similar to aprintwith error severity.
pd.sendBanginput: A string representing the destination symbol in Pure Data.output: no output.description: Sends a bang message to a specified destination in Pure Data.
pd.sendFloatinput: A float value and a string representing the destination symbol in Pure Data.output: no output.description: Sends a floating-point number to a specified destination in Pure Data.
pd.sendSymbolinput: A string symbol and a string representing the destination symbol in Pure Data.output: no output.description: Sends a symbol to a specified destination in Pure Data.
pd.sendListinput: A list of values (mixed types) and a string representing the destination symbol in Pure Data.output: no output.description: Sends a list of values to a specified destination in Pure Data.
max Lua Module
max Lua ModuleThe max module inside Lua allows interaction with Max functionalities, exposing the following functions:
max.printinput: A string message to print.output: no output.description: Logs a message to the console, similar to Max'sprintobject.
max.errorinput: A string error message.output: no output.description: Logs an error message in the Max console, similar to aprintwith error severity.
max.sendBanginput: A string representing the receiver symbol in Max.output: no output.description: Sends a bang message to a specified receiver in Max.
max.sendFloatinput: A float value and a string representing the destination symbol in Max.output: no output.description: Sends a floating-point number to a specified destination in Max.
max.sendSymbolinput: A string symbol and a string representing the destination symbol in Max.output: no output.description: Sends a symbol to a specified destination in Pure Data.
max.sendListinput: A list of values (mixed types) and a string representing the destination symbol in Max.output: no output.description: Sends a list of values to a specified destination in Max.