Max patch to Flash application?

TheAvenger's icon

I read in various posts that ther's no way to put directly a max patch on a site. For this reason, i need to knwow how to convert a patch into a flash application. How can i do? And if this is possible, max patch will work as a flash application?

mortimer59's icon

I think it's not possible( at this time to save patch as flash) so you can make communication between flash and max via flashserver.

TheAvenger's icon

Thanks for reply, but infortunately i checked and flash server is down, take a look http://www.nullmedium.de/dev/flashserver/ (At the moment flashserver isn't available). Does anyone know if ther's another way?

Jan M's icon

There are several possibilities to communicate between a website and a Max Patch. What is the best technology depends on what you want to do?
Do you want to control a max-patch from a Browser, or do you want to display a visualization from MAX, stream a Video etc...
In which direction do you need to communicate between the Web-word and the Max World etc...

Could you write more about your project?

Jan

TheAvenger's icon

I would simply insert a max application on my future site, so that any user could use it. I'd like that this patch could be posted in a topic like when you post an emoticon.

Jan M's icon

That is not possible out of technical reasons:
If you open a website in your browser the Server is generating code which will be then interpreted by your Browser.

But a browser is something very different than the Max/MSP engine. Applications like Flash, Quicktime, Realplayer, Java ect. offer plugins that execute these application on your computer (not on the server) inside a "capsule".

But there is no such a plugin for Max/MSP/Jitter.

maybe check out http://www.lilyapp.org/ if it can help you.

jan

TheAvenger's icon

Thanks for the site, i'll check this. But so, if i succeed converting max patch into a flash application, i can't do what i want anyway?

Jan M's icon

You cannot just convert a Max patch into a Flash application. There is nothing as a "Save as Flash..." button.

These are really different technologies.

But if you know Flash/AS2,3 and or Flex you could certainly build something that looks like a Max patch.

But that'll a bit of work....

TheAvenger's icon

Ok thanks for the informations man. Certainly this is a bad news, 'cos i don't wanna lose the work i'm doing on max. But before you wrote "There are several possibilities to communicate between a website and a Max Patch", so can you tell me which are these methods?

Jan M's icon

All these examples require a bit of knowledge in web technologies.

If it come to Video streaming Max/MSP/Jitter supports the RTSP stream.
with [jit.broadcast] you can send a video stream into the internet.
The quicktime plugin is able to read this stream. so you can include it into your site.
If you google a bit around you'll find some code about that. Here is an exaple using JavaScript:
http://stackoverflow.com/questions/2245040/display-an-rtsp-video-stream-in-a-web-page
(I havent tested it yet)

In the other direction you can receive RTSP streams with [jit.qt.movie]

Further more there are some object sending/receiving tcp and udp packages.

[jit.net.send], [jit.net.receive], [udpreceive], [udpsend], [mxj net.tcp.send], [mxj net.tcp.receice]

TCP and UDP are both network protocols. You can use these to communicate with a website.
To make that happen you need to use a sever-side programming language such as PHP.

A possible setup, to send data from a website to a Max-Patch that I tried once used the [udpreceive] (but only inside a network, but it should work also via Internet).

You need:
A server that is hosting your web application
A computer running your Max-patch, that has a network connection with the server.
A computer with a browser.

Now you can send data from the website in the browser to the server and from the server you will send this data to max udpreceive.

I have attached a "simple" example using php for that.
It includes a library by Andy Schmeder (http://andy.schmeder.net/software) that formats the message into OSC format (the one used by udpreceive) and send it to an IP address.

To try it:
1. Make a patch with an [udpreceive 7474]
2. You need to install a local webserver that runs PHP
(for Windows ie: WAMP or XAMPP, for Mac i.e MAMP)
3. Unzip the folder and copy it into the root directory of the Server.
4. Start the server and type localhost/webtomax/index.php as an url.
5. Open the Max-patch
6. Have fun sending messages from the browser to Max

I guess that's a lot of stuff for now.

Hope it helps...

Jan

Jan M's icon

Oh here are the PHP files...

2387.webtomax.zip
zip
Jan M's icon

And than there is [jweb] to display a web page inside a Max patch. You can also have a look at FLOSC. This is a tool to make Flash speak OSC - which can be used to communicate with Max.

TheAvenger's icon

Thank you so much for kindness. I think it's difficult for me to apply these methods connecting website and max, so i think i'll try to make a flash application. So i ask you: it's possibile to create a swf application identical to a patch i'm building on max? Thank you.

Jan M's icon

Hello Avenger,

Do you have experiences with Flash/ActionScript? If not, with some programs that create simple type of interactions (such as keynote for mac) you just export the presentation as a flash/swf movie.

But keep in mind - Flash and Max are as close as Spanish and Chinese ;)

With Flash you could "simulate" a max interface (such as sliders, dial) but you cant do audio or video/matrix-processing as in Max.

Jan.

TheAvenger's icon

No i have not experience with Flash, for this reason i was going to try learning something about it and ActionScript. Do really exist similar programs? It's very interesting Jan, please can you quote me some programs for win? Anyway, if you said that Flash only can simulate a max patch, do you mean for example i can't use a record button?

Jan M's icon

I am not really a "Flasher" but as far as I can say such thing as a record button might be possible. Facebook i.e. uses Flash to activate a built in webcam and microphone to record a video with sound and than uploads to the facebook server. But i guess that's the limit in video/audio capabilities in Flash.

How todo that is beyond my knowledge.

"Do really exist similar programs?" -> Similar to Flash? The only thing I know is Microsoft Silverlight, but this is very much in a niche.

To create a Movie-Clip with simple interactions (such as you find on a DVD-Menu) you can use the Adobe Premiere, Encore and After Effects. -> With these programs you can export the content as Flash. But they cost a fortune!!
And this is again a new Universe (interesting for sure, but not programming... )

Hope that can helps a bit.

Maybe not to flood this Forum with off-topic threads - if it comes about web-things just write me an e-mail.

TheAvenger's icon

Thanks a lot Jan, i wrote you a mail so we can continue talking there.

Aurelius's icon

I have made a patch who produce sound, controlled by a small flash game.

Does anyone know if it is possible to upload that, as a standalone max patch on a website, using the build collective function, so you dont have to run the program on your own computer.

Jan M's icon

In short: It's not possible to run a Max patch from within a browser.

squallu's icon

And what with the situation when we want to send something from max on the web site (or console, or file). I would like to send clips name from master track with js to my web site. Is it possible? is there any way to do that?