Twitter, node-red, Sonic Pi, QLab

UPDATED:

Building upon the methods explored in the original article below, I’ve been experimenting with using node-red’s Twitter node to interface directly with ruby files in Sonic Pi by means of shell scripting. By creating multiple instances of the Twitter nodes in a single flow, I can set unique search terms, strings, hash tags, etc per node, which correspond to individual ruby files. These files are then called up in Sonic

Pi, via the command line interface sonic-pi-cli. Using AppleScript syntax within a .sh file, we have the following:

Instead of connecting Twitter nodes to OSC nodes (to communicate with QLab), I am using exec nodes to run the shell scripts. When configuring the exec nodes, the Command is ‘exec’, uncheck the option to ‘append msg.payload’, and in the ‘extra input parameters’ enter the file pathway to your .sh file, including the extension. Make sure your .sh files are executable once you create them. And, obviously, you will need to set the file pathway to a location pertinent to your machine.

The json file of the Node-RED flow is:

And the stopper shell is:

The whole thing should look like this:

This method uses only freely available tools, rather than paid commercial software – which is not to say you shouldn’t use QLab if you want, but Script cues are a paid feature.

UPDATE #1:

Check out the contributed module from Sam Levey, with nodes to control QLab via OSC messages and a node to control node-red from QLab: https://www.npmjs.com/package/node-red-contrib-qlab This eliminates some steps from the method described below.

ORIGINAL:
Utilizing node-RED, QLab can respond to hash tags, text strings, etc via OSC messages and UDP packets. This is useful for audience-interactive installations, lobby displays, etc.
Dependencies:
QLab
node-RED
node-red-contrib-osc

Once the necessary software are installed, use the following to create a node-RED flow that listens for Twitter hash tags, text strings, or both, and sends OSC messages to QLab via UDP packets. You will need to enter Twitter account credentials into the Twitter In node. I use this to trigger an AppleScript cue that selects random audio samples or ruby files (for Sonic Pi generative music). Copy the following JSON and paste it into your node browser via Import>Clipboard. Log in with a Twitter account, define your search terms, OSC path and IP/port to see the results.