Integrating P5js + MaxMSP

Dear Friends

If somebody is interested in integrating p5js sketches with MaxMSP patches here is a simple example and some handy infos:


A simple solution for interfacing “patches” created in MaxMSP/Jitter and “sketches” written in P5*js. The solution uses the [jweb] object from MaxMSP to load P5*js sketch, and for bidirectional communication (messaging and sharing Max dictionaries) between MaxMSP patch holding the [jweb] object with the loaded sketch.

Thank you so much for sharing this!

Also, helpful explanation of using instance mode to avoid a namespace conflict.

So appreciated! Nice to see there are Max users here :smiley: :peace_symbol:

I have slightly updated example project by adding a mechanism to enable/disable background (opaque/transparent switching). So now it is possible to use P5js sketch loaded into MaxMSP [jweb] object as a transparent “layer”. This should make a little bit easier to create your own GUI elements in P5js - you no longer need to adjust the background color of the p5js sketch to the background color of the patch in MaxMSP.

Project’s URL is still the same:


Dear Friends

I have updated MaxAndP5js a bit. I added a second example, showing how to launch (from a jweb object in MaxMSP) a p5js sketch using Vida library for simple motion detection.

1 Like

Thank you so much for sharing this!

Have you considered putting it under open source version control – for example, hosting it on github?

Some people asked about that (mostly about Vida library on Github). Yes, I have such plans, but for now I just don’t have enough time for it - I don’t use GitHub and similar services myself, so I would just have to add one extra “layer” to my workflow.

@yaniki you are my hero! Thank you for sharing so generously!

Thank you very much.

I have to admit, that I did not expect that sharing such a simple (as I thought) idea I will receive such significant feedback from both the P5js and MaxMSP communities.

I have ideas for updates that I will try to introduce later this year. Besides, it’s probably time for GitHub or a similar mechanism :wink:

1 Like

amazing, iv been obsessed with max but some ui elements could be very inspiring.

1 Like

Dear Friends

I made some updates to the project: on the p5js side I refreshed the syntax of the example sketches (no more var!) and compatibility with new versions of Max is improved.

Oh, and there is a new example: Euclidean/Bjorklund’s rhythm generator (easy to adapt to any algorithm for generating rhythm patterns). Bjorklund’s algorithm is implemented on p5js side (don’t hesitate to copy-and-paste it if you are looking for ready-made piece of code - eventually I can prepare full-featured p5js library version later).

The location is unchanged:


Thank you for sharing this, @yaniki. Is there an open source license for using this, or do you have any terms of use that you desire?

Also, one other question – is the earlier version still available somewhere?


I didn’t think about defining the licensing model, because the project’s goal is to explain a mechanism that people will modify in their own way and according to their needs - if I forbid it, the project will be pointless ;-). But if it is important to define the official licensing model for some reason I can do that. The Creative Commons Attribution-ShareAlike 4.0 is the nearest to the licensing model I can imagine is the best for this case, because is highly permissive.

I’m not keeping older versions available online as the new one should be fully compatible with the older… at least in theory… so… hmmm… this is the point probably… I think, I can’t host all version-history but I can add link to the previous version (the last var-oriented).

Hi @yaniki – if you want it to be public domain, you can also just say “this is public domain” – whatever you like. I asked because if you make things to be used, it is nice to let people know how they may use it (e.g., with attribution). Also, if I wanted to archive a copy of this tool, it is nice to indicate what the terms are.

A link to the previous version would be really helpful, thank you. I am also happy to create a github backup / mirror of what you publish to your project page if you would like. Thanks for sharing this useful project!

1 Like