ShowKontrolMANUAL

Learning Base

Scripting basics

Intermediate · 15 min

Read the live data, calculate something, and control nodes and players by name, in a few lines of JavaScript.

A Script node runs JavaScript on the data passing through it. A script fed by a trigger runs once per fire. Fed by anything else, it runs on every tick.

Open the editor#

Double-click the Script node, or click Editor ⤢ in its settings. The full-size editor has line numbers, colouring and Tab completion against this node's real data keys. It also has live validation: a moment after you stop typing, the script is run against the current live data. Errors show in red at the bottom, and ✓ runs on live data means it is clean.

▶ Run applies the script and fires it once. Close applies it and returns to the Patch. Until then, the node keeps running its last good version.

Read and write#

Write with plain names. Reads see the current data and writes become the node's output:

system.beep = CDJ1.beat.bar;                        // beep every bar
value.inChorus = (CDJ1.phrase.current == "CHORUS") ? 1 : 0;
value.bpmRounded = Math.round(CDJ1.beat.currentBpm);

Reading a key that doesn't exist throws and shows the full path, so typos surface immediately. Keys you don't set pass through unchanged.

When you need both the original and the changed value, use source. (in) and output. (out):

metadata.title = source.metadata.title + " [LIVE]";

Control other nodes by name#

Every node setting is reachable by the node's name, from any script:

output.MainRouter.router.active = "Input 2";   // switch a router
output.FXScript.node.bypassed = true;          // bypass a node
output.OSC.node.stopped = true;                // stop a node

Don't want to hard-code names? parent is the node that owns the incoming data (the Device or the last Router). child is whatever this script feeds:

var bar = source.parent.beat.bar;
output.child.node.bypassed = true;

Drive the players#

Writing a setting.*, util.*, led.* or status.* key changes the real CDJ or DJM:

output.CDJ1.setting.quantize = 1;   // player setting
output.CDJ1.led.sync = 1;           // sync off? → press Sync
output.CDJ1.playback.state = "paused";

Draw#

Wire the Script into a Graphic node and draw with g.*:

g.clear("#101014");
g.rect(4, 4, source.CDJ1.beat.beatInBar * 40, 24, "#f32a8b");
g.text(8, 60, source.CDJ1.metadata.title, "#ffffff");
g.waveform(0, 80, 640, 60, "detail", 1);

The Graphic node can output to a screen or NDI.

ShowKontrol R27 (27.0.1) · Last update: 2026-10-15 · What's new · © TC Supply LLC