A question I can't find a simple answer to... Converting Max patches

Kalou's icon

Hi,

I have a simple Max patch which incorporates pre-recorded audio files. I want to make it into a stand alone application so I can embed it into my webiste.

Is there a way (hopefully a simple one as I'm not a programming genius) to do this. Someone suggested to me to make covert it to Java, but I don't know hoe to do that.

Any help would be most appreciated. I can post the patch code if needed.

mesa.elech/tele's icon

if it's simple enough that you just playback those files,
you can convert it to a flash file.
flash is probably much simpler and easier to start than java,
although it is not a very cheap program.
(but you get to do a lot. like audiotool.com)

i think i saw a similar question in the past in this forum.
if you do a search you may find a better solution.

dthomas86's icon

Here's the link to the forum that mesa.elech/tele was talking about https://cycling74.com/forums/max-into-flash-2

Kalou's icon

Hey guys,

Thanks for the advice. There is actually more than just audio files in the patch - I mean there is Max programming as well. I will look into Flash and the link on the forum.

Kalou's icon

Maybe it'll be easier to solve this is I show you the patch I am trying to embed into my website. This is a slightly older version but basicaly the same: http://www.kalou.co.uk/tube.html

So basically all there is in this patch is some Max Programming and audio files and I am looking for a way that I can embed this into a page on my website so others can use it without having to download the patch/max runtime.

The flash option seems quite complicated as well expensive. Any other ideas?

mesa.elech/tele's icon

nice project! i love train sounds...

i looked into your patch and it looks very straight forward as far as sound processing goes.
all i saw were fade-ins and fade-outs (correct me if i'm wrong).
this should be fairly easy to convert to flash, or other formats.
html5 maybe able to handle it although i don't know in detail how to...
javascript probably can handle it as well.
processing too maybe? (it's essentially java, but probably easier...)

if the main issue is having to download max runtime,
you can also build max application of the patch.
(but this will not run on the browser.)

Brian Gruber's icon

First off, i really like this project.

As others have said, there's no straightforward conversion tool that lets you put your max patch on the web. You basically have to rewrite it for some other platform. The two you would probably think about are Flash or just HTML + JavaScript. In your case, the HTML would be used to put the map and buttons up there. Most of the real work would be in JavaScript, probably through some general-purpose library like jQuery (it's the most popular one nowadays). Playing the audio without any flash (just html) is an "html5" feature, and something that only more recent browsers can do, but there are projects like SoundManager that will play the audio using flash or html as required by the user's browser. The html audio stuff can't do much audio processing (yet) but it looks like you're just changing the volume, and it can definitely do that.

Some of the graphical stuff (making the buttons look the way you want) may be more difficult in the html route, but I'm not sure. Again, some of the html5 features may make that easier, but it will only work in more recent browsers.

What your patch does seems to not be awfully complicated (although you get a great result!), so reimplementing it shouldn't be that big of a deal for someone who is experienced in whatever platform you choose. But it will require you to either learn how to use that platform or find someone else who does.

Kalou's icon

Thank you both for your constructive feedback - it's a real help. I think perhaps I was being a bit optimistic thinking there was going to be a simple way to embed the patch into a web page. The easiest thing to do of course would be to ask people to download the Max run-time but I know a lot of people are apprehensive about downloading software they haven't heard of. I want the patch to be used and enjoyed by others and hopefully inspire others to make maps for their city so I think it's important it's embedded even it it's a more rudimentary version - it'll at least give people an idea then.

Mesa - It is pretty much just fades in the programming. Just to check, did either of you try out the patch? Did everything work okay for you? There's one extra bit of code I'd like to add and that is to have the button of the station (audio file) that is playing to flash - so people know where they are? Any ideas how to do this?

I am going to research into using the tools you both mentioned in relation to making some of version for the webpage. I don't know any programmers so I guess I'll try and do it myself - Your feedback makes me think it's worth the effort.

Brian Gruber's icon

@Kalou:
just wondering... did you come to any decisions regarding how you would do this?

Chris Muir's icon

This is a nice idea. The stuff is still downloading, so I haven't looked at it yet.

Short term, you could save people one step, by building Mac/Win applications in Max, so they didn't have to download the runtime.

Longer term, this could be recoded in HTML5 or Java (for the widest audience) of Flash if you had too.

Kalou's icon

Chris - Cheers for the feedback. Creating Mac and Windows applications is indeed a good short term solution. Initially I thought that was the solution to my larger problem.

Brian - I haven't had a chance to look at HTML5 yet. As someone who can barely program things in Max, learning a new new programming language (if that is how it works) is quite daunting. I'd much rather collaborate with someone who knew how to put something like this together. As I don't though I will look into HTML5 and Java and see how plausible it would be for me to create a new web friendly version.

I definitely think having it embedded in the site would make it a lot more accessible and encourage others to create their own versions of different cities which could be quite exciting.

Brian Gruber's icon

so, i was looking for a web-oriented project to do, and I've had some (too much) spare time, and after i saw this my brain kind of ran with it and...

It's not quite finished but all of the basic functionality is there. There's a fair amount of optimization to be done about when the sounds are loaded, the buttons have to be tweaked so they look right in IE8 etc. Let me know what you think.

Kalou's icon

Wow, I am really impressed! That is pretty much exactly how I had it in mind. Aside from the completing some of the buttons and if possible making them white to match the original map's aesthetic, the only thing I think it needs is the fades.

I originally programmed so that each file faded in and out for 1 second. While the current audio file was in the process of fading the next one in the sequence was fading in. This allowed for a more cohesive soundscape

One other attribute I think would make it a lot clearer to use would be if somehow the button of the current station would blink so the user knew where they were. I tried to implement it into the Max patch but couldn't figure out how.

Again, Brian I think it's looks brilliant. You've done something in a couple of days that i have thought about doing for over a year!

Brian Gruber's icon

was the max patch doing the fade-ins/fade-outs live, or are they pre-rendered to the audio files (i don't have access to a copy of max right now)? i hear there's at least some fading in and out on the audio files. for the webapp it will certainly be easier to pre-render that. making the sounds overlap is quite simple though.

i held off on doing a blink or animation of some kind on the buttons because i have to do some research on how to make them look right cross-browser (I checked them out on an iPad and they looked real ugly--surprising because they look fine in safari on a mac). i did put in some feedback by turning the current station green.

glad you like it.

Kalou's icon

I'm red/green colour blind so I must have missed the station turning green.

The audio files weren't pre-faded. In the max patch there are two sample players. One controls the station sounds and the other the train sounds. This made it easier to automate the 1 second fades and overlap the stations/trains using the 'function object'. I don't have a problem going through the files and manually inserting the fades, that they can overlap is important though.

Out of curiosity did you have to convert the audio files to mp3s so they'd load quicker, and are they all uploaded onto your server?

Brian Gruber's icon

I converted them to mp3 because yes, it loads quicker, but also because few browsers support wav files for html5 audio. One of my goals is to have this work, properly, on a variety of browsers.

Don't bother doing the fades; it's not much more work for me to do it myself than it is to start downloading it and re-encoding it to mp3 etc.

All of the files (audio, etc) are living on github right now. see http://github.com/bgruber/tubemap for complete version history etc. Actually, you'll see there are also ogg files there, although i haven't gotten around to figuring out how to get soundmanager to use those if a browser has no flash and no mp3.

Kalou's icon

Really appreciate the help Brian. Could you please email me at info(at)kalou.co.uk so we can discuss more?

Kalou's icon

If anyone is interested, with a lot of help from Brian Gruber, my Sonic Tube Map has now been ported from MaxMSP to the Internet. You can check it out here:

www.kalou.co.uk/tube.html

If anyone has any feedback I'd be interested to hear it.