Let's start with the basics.
- To program procedural operations that may be difficult or impossible to implement using Max objects by themselves (these may include operations that require recursion or respond to messages with an unknown number of arguments.
- To create objects that respond to customizable messages and rely on their own internal data structures.
- To schedule timed events in response to messages.
- To manage global variables for use among multiple js objects or between js objects and the Max patcher.
- To interface to Max’s scripting architecture.
- To access the file system of your computer to look for files by name and types
Starting At The Beginning
The jsui Object describes properties and methods that are specific to the jsui object itself. The jsui object exposes the MGraphics and sketch drawing routines for visual output.
The MGraphics QuickStart Guide runs down the required initialization and routines you'll need to use the MGraphics system within the jsui object . To see MGraphics in action, Darwin Grosse's 2011 November Patch-a-Day sequence of tutorials is a great source of examples and enlightenment.
Live If You Want It
The Live API Overview provides the basic information about the Live API.
Of course, you'll want to keep a copy of The Live Object Model documentation close at hand, too.
Working With Jitter
- To receive callbacks from Jitter objects by listening to them and calling functions based on the results.
Node for Max
Want to see a couple of examples of the cool things you can do using Node for Max? Shiva Kannan used the Node for Max module to write a Slack app that can convert a channel's real time messages to music using Max.
Chris Konopka's xeno-canto lets you create a bird sound sample with birds from around the globe using Node for Max.
The very best place to start getting into Node for Max is to sit down for a few minutes with Cassie Tarakajian:
Recipes for Success
Andrew Benson's astounding trio of Node for Max Recipes provide examples of using Node for Max in real-world situations, and run you step-by-step through inspiring activities that will open this world for you.
Node Recipe 00: Socket Drawings provides an example of sending and receiving realtime SocketIO data in Max, extracting dictionary data from JSON to a Jitter matrix, and combining server, client, and web interfaces. Node Recipe 01: Installation Calendar demonstrates using ReactJS to generate a dynamic web front-end for Max, setting up an Express.js API for Max, and manipulating data stored in a file. Node Recipe 02: The Crowd uses an agent simulation library to generate complex behavior and demonstrates how to pass dictionaries between Max and Node.
More Examples and Sources for Inspiration
Note: Darwin Grosse and Florian Demmer have collected a number of questions about getting started with the examples we've provided, and have provided a great Q&A-format introduction to the available content.
There are actually three repositories, each with a different purpose.
The Node for Max Core Examples repository is the location of the most basic examples, and is authored and maintained by Cycling ‘74. This is the starting place for people that are new to either Node.js or Node for Max, and provides examples of good beginners’ patches and use of the API.
The Node for Max Examples repository tries to show complete (but limited in scope) projects using N4M. It extends the use of Node.js to do some ‘real world’ functions, including the creation of a simple web server, interacting with a third-party API, uploading files to your patch and using a music theory library for building chords. These examples make extensive use of npm libraries, which is a staple in the world of Node programming.
The Node for Max Community Repository contains links to projects, templates, hints and examples from the entire community. This is a constantly growing collection of work, and can be a great place to check out how people are approaching N4M, or what is already available!The list of projects is pretty interesting, ranging from YouTube video streaming to skeleton tracking using the PoseNet library, and you will bet to see other N4M developers in full-tilt action.
In addition, Christopher Konopka has created a GitHub repository full of amazing examples which provides a rich supplement to the repositories listed above. You won't regret the time you spend there.
There's More (And How To Find It)