Forums > MaxMSP

code translation? max/msp-> java or C

September 4, 2007 | 2:21 am

Hi everyone,

I was wondering if there are any programs that would translate
the text code of a max patch to java or C code automatically.

A few years back, I programmed a very complex patch for tracing
3d paths that are used to spatialize sound in 3D. I would like
to keep working on this program, but it would be much easier
in C and more efficient.

Or course, I could port the code myself… but, this would be long.

Is this even possible?

thanks


September 4, 2007 | 3:54 am

You’re better off learning C and writing it yourself than what you’re asking
for.

Writing a parser that takes pat file input and automatically parses that
into C/C++ or even Java source code is a "hard problem." Code synthesis
tools do exist, like Rational Rose based on UML/object to code generation.
However if you ever look at the code generated, you’ll realize why tools
like this are a ways off from being taken more seriously by developers. I
would suggest looking for a patch or a tool that already does what you’re
asking for. It will be much easier than writing a parser.

Brandon

On 9/3/07, Pierre-Emmanuel Levesque

wrote:
>
>
> Hi everyone,
>
> I was wondering if there are any programs that would translate
> the text code of a max patch to java or C code automatically.
>
> A few years back, I programmed a very complex patch for tracing
> 3d paths that are used to spatialize sound in 3D. I would like
> to keep working on this program, but it would be much easier
> in C and more efficient.
>
> Or course, I could port the code myself… but, this would be long.
>
> Is this even possible?
>
> thanks
>


September 4, 2007 | 4:02 am

Thanks,

I was expecting this kind of reply. I do a lot of web programming so I know how editors create crappy bloated code. I do all my coding by hand.

I was just wondering what if? And wanted to be 100% sure.

I’ll have to move my code to C myself.

I have never found anything that does what my patch does.

thanks.


September 4, 2007 | 10:44 am

Quote: bbnickell wrote on Tue, 04 September 2007 05:54
—————————————————-
> Writing a parser that takes pat file input and automatically parses that
> into C/C++ or even Java source code is a "hard problem."
—————————————————-

Not only that, but your code generator would need to know how every object instantiated in your patch works. IOW, it would need to be able to re-implement all ~340 standard objects from 2d.wave~ to zmap, about 50 UI objects (from dial to zplane~), a couple dozen built-in objects (from message box to patcher), never mind objects by independent developers (www.maxobjects.com lists about 3,500 such items, ranging from ! to zerocross~).

That’s a pretty massive code project.

I have worked on re-implementing a massive Max/MSP application (ca. 1.5MB patcher code) to C/C++. Although there is quite a bit of work involved, it is considerably more tractable than attempting to build a general "Max to C translator". The biggest effort is recreating the quite rich world of Max UI elements. The actual calculations are usually fairly straight forward.

Which reminds me: does anyone know of a Windows Forms equivalent for multislider?

– P.


June 17, 2010 | 10:40 am

what’s up gentlemen,

I stumbled across this exchange in the midst of my own research and I thought I’d take a shot in the dark here…

"I have worked on re-implementing a massive Max/MSP application (ca. 1.5MB patcher code) to C/C++. Although there is quite a bit of work involved, it is considerably more tractable than attempting to build a general "Max to C translator". The biggest effort is recreating the quite rich world of Max UI elements. The actual calculations are usually fairly straight forward."

I am an aspiring programmer who is working on a couple of different personal music applications and I desire to get down to the heart of the beast when it comes to building/coding my Frankenstein. Foremost, I have every intention to be my own "Max to C translator", however, I am new to programming on such a low level. Turns out, I am a sponge and everything I’ve learned so far has come with an encouraging level of fluidity although I owe that to everyone who has pointed me in the right direction (even if it’s back from where I came).

"The actual calculations are usually fairly straight forward."

No point in dancing around it… Where is a good place to start learning how to make the calculations and what information do I use to do them?

I know that this has to be the simplest and most basic way to communicate with the computer and that is what I want to do. So that when I tell it to do something, nothing else gets in the way. I figure this is the best way to get the most efficient and consistent response from an application of any kind.

Any thoughts would be sincerely appreciated…hope someone actually reads this haha


June 17, 2010 | 8:26 pm

Along these lines, I’m wondering about the Max-to-Arduino project that Cycling is apparently working on… any word yet? Saw a small demo of it last year. You use a set of special objects and make your patch, it generates Arduino code from it. Rather like what’s being described here, but understandably not using the massive set of already-implemented objects, which would be insane to try and tackle.

Still, I would love to tinker around with that… imagine the learning possibilities for Max users who aren’t great with code, but even more important, code users who are learning Max. This would give them something they understand right away and allow them to see how it’s implemented in a patch.


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