Forums > Javascript

processing.js in Max

November 15, 2012 | 9:07 am

Hello

No news about use processing.js inside Max
Is it possible or not?
It would be amazing!


November 16, 2012 | 4:19 am

I’ve been thinking about this… would it be possible to export to javascript and then just use [js]?


November 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


November 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 :)

Attachments:
  1. processingTest.zip

November 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.


November 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 processingjs.org 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?


November 20, 2012 | 4:37 am

http://js.processing.org/reference/articles/jsQuickStart#javascriptonlyprocessingcode

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.


December 5, 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:

http://robertesler.com/libpd-with-processing/

-Mike


April 16, 2014 | 2: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…


April 17, 2014 | 9:05 am

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.


April 17, 2014 | 8:03 pm

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]


April 18, 2014 | 7:49 am

Well that is strange…

What version of Max are you running? Are you Windows or OSX?


April 18, 2014 | 5:22 pm

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
}


April 19, 2014 | 8:53 am

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.

Attachments:
  1. processinglib.js

April 19, 2014 | 5:28 pm

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?


April 20, 2014 | 8:36 am

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.


Viewing 16 posts - 1 through 16 (of 16 total)