Noob java - max question

Nick Donovan's icon

Sorry for noob question guys, I'm new to coding and stuff and its relationship with an object language like maxmsp. Basically I want to know if there is anyway to turn a max patch into javascript - I need a way to change patches into common code (I know I can't do C, but I know max works with java so thought it might be worth a shot asking).

Many Thanks for any replies
Nick

Charles Baker's icon

As I understand the question: no. javascript can be used to "auto-generate"/"script" Max patches....but a Max patch cannot be made a javascript program that would function in a browser without Max.

Nick Donovan's icon

Thanks Charles, guess I'm better of learning C then

ShelLuser's icon

What is it you want to do anyway ?

Nick Donovan's icon

Well, I wanted to make something in Max (ideally) and then somehow have that running in a browser - I got excited about Native Client from google but realised it only supports native code C and C++. So I guess I back to being faced with learning one of those or Flash

ShelLuser's icon

Now, I don't know how feasible this is but you do realize that both Max and all common browsers contain a javascript engine ?

So while you cannot turn a Max patch into javascript code you can embed javascript code into a max patch (or a max project). And that might give you options enough to have that code executed in a browser.

Jason Orri's icon
Nick Donovan's icon

The only problem I see is that it might mean I just need to learn Jscript and max becomes redundant anyway?

ShelLuser's icon

That question is impossible to answer without knowing what this is all about.

CR4SH3D's icon

hi guys, i take it this answers my similar question of:

if you write an external in eclipse with java, can it run inside that compiled application/applet and interact with the code?

im using java/processing for an audio based game and wondered if for example a granular sampler could mangle the bg music when the player dies? i kind of assumed you cant since there isnt any info on it but im not sure what with using eclipse etc

thanks in advance

Jan M's icon

@CR4SH3D:
In short no! :)

In long: An external written in java is a class that extends a parent class (i.e MaxObject). These classes are defined in the .jar files that come with max and they do interact with the Max/MSP application. Very similar to function JavaScript inside Max you can use your Java class (through th [mxj] object to interact with max.

Think about both (Java and JS) as a kind of (programmable remote-control) to Max/MSP/Jitter.

The difference between Java and JavaScript inside Max is that Java inside Max has more options than JavaScript. It can not only interact with the Max/MSP application but also with the computer itself (i.e. you can create your own windows, make network connections and many other things). And it is much much faster than JavaScript.

So even if you write a Max Java class and you would manage to implement this class in your processing environment you still don have the Max/MSP functionalities inside processing.

So you cannot "import" the sound engine of Max into Processing by using Max-Java Classes.

I don know much about processing at this point but it seems to be a Java-Framework with a focus on visualizing data...

So it would be most likely possible to interact between Processing and Max - but this would be in a more indirect way i.e. by sending data from one app to the other via a network.

J.

mudit's icon

Hey, i would reallllly appreciate if someone can help me out pleasee.
Well, i have the java code written, with the interface and sounds(predefined) in eclipse...
But now, what i wanna do is send that sounds from eclipse to max msp, so that i can process that sound with effects through that max msp patch!! How to do that? HELP!!