Node in Max

by Julian Rubisch, 2019-04-03javascriptmaxcreative-coding
01 Watch YouTube Videos

When I first heard that Max is getting a NodeJS integration, I thought to myself, what endless possibilities. I'm not the greatest supporter of the JavaScript language and the environment it lives in, but hey, the premise of re-using other software I had written in Max was just too tempting. That said, when it finally came out I was a little stunned not to find a more detailed introduction in how to set up a project with NPM, install modules etc. Maybe I didn't search intensely enough, but at least there wasn't something screaming at me: "TRY THIS". So well, while everybody else is freaking out about MC, here's my first take on Node in Max, a little script that allows you to play arbitrary YouTube videos in a `[]`. When I asked on Twitter what could be a nice starter project, the answer I got was "People will go nuts if NodeJS lets you open youtube tutos". So I just did it.

  Go to video
02 Static D3JS

I love d3js for data visualizations, I mean, who doesn't? Sometimes, though, it'd be nice to obtain an SVG without having to embed the relevant code in a website, run it in a browser and copy-paste the result. With an npm package called d3-node, this is possible, with a few limitations. We'll wrap this in a node.script and use it to render PNG files to be used in a Max patch.

  Go to video
03 SocketIO Client

A neat fact about node.script is that it gives us access to a bunch of Web APIs that are easy to implement using nodejs. The official Node4Max examples include one about creating and running a WebSocket server; I'm going to show you the opposite, how to make Max behave like a WebSocket client.

  Go to video
04 MQTT Subscriber

MQTT is short for _Message Queueing Telemetry Transport_, and is a machine-to-machine communication protocol for the transmission in environments of high latencies and flaky networks. Why is that interesting? Because MQTT is the standard protocol for IoT applications, the Internet of Things' heartbeat so to speak. Chances are, if you have any smart home or sensor devices at home, they already transmit or offer MQTT at some endpoint, so here is an opportunity for a wide range of sensor and actor integrations which can be a great source for various artworks.

  Go to video
05 Live Coding REPL

An exploration of how an efficient live coding shell could be set up with node4max. NodeJS already has a lot of the requirements covered, so we're going to take a deeper look at this.

  Go to video
06 REPL with History

Let's consider a nice little addition to our REPL. All modern shells that are in use today provide a means of accessing the history of commands issued to it by typing the up and down arrow keys. readline actually does this natively, but because we are dealing with an external environment here, we have to do a little extra setup.

  Go to video
07 Live Coded Patcher Scripting

What I intend to do in this tutorial, is make parts of our actual patcher live-scriptable by exchanging the contents of a bpatcher. Basically, we're using our Node script to invoke the „maxy-gen“ command line tool with the arguments given to it from our REPL. Enjoy!

  Go to video
© 2018 Znibble~Powered by Contentful
Privacy Policy NewsletterImprint