node-max
Jumping off point for debugging max JS patches w/ node.
Basics
Inspired by a conversation on the llllllll forum,
a few starter files to help jump-start using node.js to debug and test
your Max/MSP Javascript bits.
Included here are:
max.js- a sample file with a few maxisms (a stand-in for your real code) that defines a nodule module exporting functions to test drive.driver.js- the driver. This defines a sandbox from which you test drive functions exported by the module defined in themax.jsfile.
Getting Started
Preliminaries
This assumes you've got node.js installed and some environment in which you
can debug node apps. (The Node.js Applications with VS Code tutorial
is great if you want to give vscode a whirl.)
The Recipe
- grab the sources (
git clone https://github.com/pq/node-max.git). - copy
driver.jsinto your project directory. - update the JS file(s) you want to test to define modules that export functions of interest.
- import these modules into
driver.js(e.g., updaterequire('./max')to specify your module and repeat as needed). - add a call to one of your functions to the sandbox area of
driver.js(e.g., likemax.bang()in the template). - set a breakpoint.
- create a
launch.jsonconfiguration file that specifiesdriver.jsas its program (maybe like"program": "${workspaceRoot}/driver.js"). - run!
Next Steps
This is basically a lark. If it ends up being useful, I'll add more bits (more Max functions in particular). If you have interest, feel free to file an issue or better still, submit a pull request!