You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Andrew Belt b4115a2ed1 Change default knob value to 0.5. Add vco.js. 5 years ago
examples Change default knob value to 0.5. Add vco.js. 5 years ago
res Initial commit 5 years ago
src Change default knob value to 0.5. Add vco.js. 5 years ago
.gitignore Remove buffering from host. DuktapeEngine: Replace Proxy getters/setters with normal arrays. Use r,g,b properties instead of indices for light colors. 5 years ago
LICENSE-dist.txt Initial commit 5 years ago
LICENSE.txt Initial commit 5 years ago
Makefile Initial commit 5 years ago
README.md Replace ProcessBlock with direct access via ScriptEngine methods. Update readme. 5 years ago
plugin.json Initial commit 5 years ago

README.md

VCV Prototype

Scripting language host for VCV Rack containing:

  • 6 inputs
  • 6 outputs
  • 6 knobs
  • 6 lights (RGB LEDs)
  • 6 switches with RGB LEDs

Discussion thread

Scripting API

This is the reference API for the JavaScript script engine, along with default property values. Other script engines may vary in their syntax (e.g. args.inputs[i][j] vs args.getInput(i, j) vs input(i, j)), but the functionality should be similar.

/** Display message on LED display.
*/
display(message)

/** Skip this many sample frames before running process().
For CV generators and processors, 256 is reasonable.
For sequencers, 32 is reasonable since process() will be called every 0.7ms with a 44100kHz sample rate, which will capture 1ms-long triggers.
For audio generators and processors, 1-8 is recommended, but it will consume lots of CPU.
If this is too slow for your purposes, you should just write a C++ plugin.
*/
config.frameDivider // 32

/** Called when the next args is ready to be processed.
*/
function process(args) {
	/** Engine sample rate in Hz. Read-only.
	*/
	args.sampleRate

	/** Engine sample timestep in seconds. Equal to `1 / sampleRate`. Read-only.
	*/
	args.sampleTime

	/** Voltage of the input port of row `i`. Read-only.
	*/
	args.inputs[i] // 0.0

	/** Voltage of the output port of row `i`. Writable.
	*/
	args.outputs[i] // 0.0

	/** Value of the knob of row `i`. Between 0 and 1. Read-only.
	*/
	args.knobs[i] // 0.0

	/** Pressed state of the switch of row `i`. Read-only.
	*/
	args.switches[i] // false

	/** Brightness of the RGB LED of row `i`. Writable.
	*/
	args.lights[i].r // 0.0
	args.lights[i].g // 0.0
	args.lights[i].b // 0.0

	/** Brightness of the switch RGB LED of row `i`. Writable.
	*/
	args.switchLights[i].r // 0.0
	args.switchLights[i].g // 0.0
	args.switchLights[i].b // 0.0
}

Adding a script engine

  • Add your scripting language library to the build system so it builds with make dep, following the Duktape example in the Makefile.
  • Create a MyEngine.cpp file (for example) in src/ with a ScriptEngine subclass defining the virtual methods, following src/DuktapeEngine.cpp as an example.
  • Add your engine to the “List of ScriptEngines” in src/ScriptEngine.cpp.
  • Build and test the plugin.
  • Add a few example scripts and tests to examples/. These will be included in the plugin package for the user.
  • Add your name to the Contributers list below.
  • Send a pull request. Once merged, you will be added as a repo maintainer. Be sure to “watch” this repo to be notified of bugs in your engine.

Maintainers