processing.js in Max

    Nov 15 2012 | 9:07 am
    No news about use processing.js inside Max Is it possible or not? It would be amazing!

    • Nov 16 2012 | 4:19 am
      I've been thinking about this... would it be possible to export to javascript and then just use [js]?
    • Nov 16 2012 | 8:18 am
      it would be great to use directly [jsui] I will try this morning, if it works i will share an exemple
    • Nov 17 2012 | 7:07 pm
      I got this to work. It uses [jweb] so I don't know what kind of output/input you can get from this way of doing it.
      But at least I got something to work :)
    • Nov 18 2012 | 9:17 am
      I tried your patch on a windows computer without any luck. Any idea why this is? I can open the html document separately. Jweb finds the file htmlProcessing.html, it just does not display anything.
    • Nov 19 2012 | 12:32 am
      I just tried downloading and opening what I posted and it works here.
      It should work on windows, I didn't use an external and processing.js is the same for all platforms. Maybe try your own processing sketch? It didn't work for the first sketch I tried to run, and I never found out why. You can just modify the html file (which by the way contains an extra line I commented out because I originally copied the html from the homepage - in case you were wondering what that was) to have your file name instead (and make sure your sketch is in the folder with the max patch).
      If another sketch doesn't work, then I might suggest asking on the processingjs forum about javascript compatibility. maybe?
    • Nov 20 2012 | 4:37 am
      This link might prove to be useful... also if you scroll up a bit there's a heading called "Pre-compiling Processing code to JavaScript" which is what I'm trying to do now.
    • Dec 05 2012 | 6:17 pm
      Looks like I'm the only one interested in this ;) hehe
      BUT, I just figured out what the deal is with libpd.... and it's not Max, but PD... and it's not processing in PD, but PD in processing I know it's a little off topic, but I thought it may be useful to know about
      This website was most useful to getting it to all work:
    • Apr 16 2014 | 9:56 pm
      Hi, I know this has sat idle for a while, but I am wondering if you pushed on this any further? I am trying to simplify a set up that includes a Processing sketch that sends video data out a serial port by pulling that data via syphon from wherever... I'd prefer if I could somehow wrap that part of the system (the processing sketch) up into some javascript and just run it inside my Max patch, skip the syphoneing and just send my jitter matrix right into the js...
    • Apr 17 2014 | 4:05 pm
      I have worked on this pretty extensively. I am currently working on a porting library for processing sketches using mgraphics.
      The basic idea is you take your processing sketch, convert it to java script (which is pretty easy after you have done it a few times) then run the sketch. It should appear and behave as it does in processing.
      Although I have not ported over the full precessing API, I have enough here to do some interesting stuff. I have attached what I have so far. Feel free to give it a spin and let me know what you think.
      Please put processinglib.js in your Max jsextentions directory, then restart max before running the sketch.
    • Apr 18 2014 | 3:03 am
      hey Anthony this looks really interesting but can't seem to get it working:
      loading P_2_2_3_02 js: processinglib.js: Javascript ReferenceError: mgfx is not defined, line 226 js: processinglib.js: Javascript ReferenceError: mgfx is not defined, line 226 js: error calling function setup [P_2_2_3_02-2.js] jit.pwindow: jit.pwindow: object u905000363 is not a valid matrix js: P_2_2_3_02-2.js: Javascript TypeError: plib.draw is not a function, line 93 js: error calling function bang [P_2_2_3_02-2.js]
    • Apr 18 2014 | 2:49 pm
      Well that is strange...
      What version of Max are you running? Are you Windows or OSX?
    • Apr 19 2014 | 12:22 am
      here's the details; the js object instantiates and I can see the code when it is sent the open message. The js extension is where you specified... OSX 10.6.8, { "version" : "Version 6.1.4 (22b50b3)", "platform" : "mac", "arch" : "x86", "osversion" : "Mac OS X Version 10.6.8 x86_64", "samplerate" : 44100, "iovs" : 1024, "sigvs" : 64, "scheduler_in_audio_interrupt" : "off", "audio_drivername" : "Core Audio", "audio_driver_subname" : "", "eventinterval" : 2, "overdrive" : "off", "mixerparallel" : "on", "mixercrossfade" : 1, "mixerlatency" : 30.0, "mixerramptime" : 10.0 }
    • Apr 19 2014 | 3:53 pm
      Okay, I sorted out the problem. I sent the wrong version of processingLib.js I have attached a new version. Please put it in your jsextension directory and restart Max. Then start the sketch and let me know if it works.
    • Apr 20 2014 | 12:28 am
      Thanks Anthony, your example patch works on my machine now. Very cool. I'm assuming the empty functions like
      function smooth() {
      are processing functions that have not yet been remapped to mgraphics?
    • Apr 20 2014 | 3:36 pm
      Yes, that is correct. I believe smooth() turns on anti-aliasing in processing. I did not put any implementation there because anti-aliasing is always on in Jitter. I also have it there so that porting sketches will be easier.