Further Adventures with Twitter, node-red and Sonic Pi

Building upon the methods explored here, 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.

Author: kreivalabs
Creative Design & Engineering