Code Gen for iOS

pascal2000's icon

Hello,

I am currently following a training at the IRCAM on Max/MSP. I am an XCode developer and I create audio applications for the iPad and iPhone. My aim is to be able to integrate Max/MSP real-time audio possibilities into iOS projects. Thus I am very much interested in the new Export possibility with Gen to C++ classes.

There are existing projects that have been built with PureData and LibPd with some great real-time abilities as well as the possibility of building and using patches in a direct way. Therefore I hesitate whether to dig into Max/MSP and to rely on the Gen export, or to rely on LibPd that has already used on various projects.

Would someone know if the iOS export with Gen is a path that Cycling intend to continue actively? Can I rely on the iOs Export to be able to use most (if not all) of the Max/MSP real-time audio possibilities? How well are the C++ classes optimised regarding performance? Or would it be safer for the time being to LibPd?

Thanks. Regards,

Pascal

woyteg's icon

an I rely on the iOs Export to be able to use most (if not all) of the Max/MSP real-time audio possibilities?

You know that the code export feature only exists for gen patches right?
although libpd also has some pretty annoying limitations (no expr eg.), you get a lot more when you use libpd than with code export in max, since the objects in the gen domain are very lowlevel.
Also, I guess it should be possible to combine these. You can create some DSP code in gen and use libpd rather as an audio framework. Hope that helps a bit.
cheers!

pascal2000's icon

Thanks.

As I am in the process of learning MaxMsp I don't know what limitations the code export has. Regarding the low level programming, I am used to code with Core Audio, C++ and C files. I had a look at the iOS Code export (*) and it looked readable to me.

I must say the Gen description on the web page is not very clear. It says : Gen quickly converts what you build visually into efficient compiled code as you go. Now you can take the generated code and use it outside of Max with Code Export. With Gen Code Export you can: * Generate C++ audio DSP code with gen~. Gen audio can now be exported as C++ DSP code with a library of supporting functions.

To me it sounds like you can generate C++ audio DSP code from a Max/MSP patch. But it is not the case, is it? So what is exactly Gen? Thanks.

Regards,

Pascal

(*) somehow the beta section with the ios export code example is not accessible anymore

woyteg's icon

Yep, that's what I meant. With libpd you can use the whole pd and loose some(many) objects.
With gen-code export it's a bit different.
Gen~ is new to max 6 and you'll find infos on this site about it.
It behaves like a reduced MSP with extra efficiency(since it's compiled) and the possibility of single sample delay feedack. You create a gen~ object and simply patch inside. No gui objects and the like, it's just made for audio DSP stuff. (and shader stuff)
And you can export this code. That's what I meant with lowlevel, although that's not really lowlevel, it is lower-level than MSP.

And that's also why I mean you may think about combining these. If you need a nice filter: code it in gen and export it. If you need a more complicated framework, the max/pd message domain etc. use pd. I don't know, if you're good at C/C++ you might even make a pd external of you gen~ filter and combine it that way.
Hope that helps,
cheers

pascal2000's icon

Ok thanks.

It actually sounds like it could fit my needs. I develop real-time audio software and I'd like to develop some fairly contained audio modules. Mainly filters and audio synthesis. That's sounds like something Gen could handle, doesn't it?

Cheers,

Pascal

vichug's icon

i dislike to point that out to you, but if your only interest in MaxMSP is for the gendsp language, you might as well look at Faust or some other lower-level programming language. The strength of max lies in prototyping possibilities. Code export is, at the moment, only one of its strength, and a pretty beta strength, so i don't know.
That beeing said, for doing filter and audio synthesis gen~ has a lot of awesome possibilities, and is a really fancy environnement to work with - if you like the graphical programming thing - compared to its other code-based counterparts.

pascal2000's icon

Coming from Core Audio low-level programming, so far, I am greatly enjoying my Max/MSP training with all these lovely little graphic objects patched together. FAUST looks interesting but there is only so much one can learn.

pascal2000's icon

I'd like to be sure that I have understood well the difference between LibPd et Gen :

- LibPD is a library that allows you to load and run PureData patches in iOS application, therefore it is (or behaves like) a real-time interpreter for PureData patches
- Gen allows you to export the content of a Gen object to C++ files that you can integrate and compile in XCode. Which allows you to convert Gen Patches to compiled code
- Therfore, althoug Gen give you access to a limited set but allows you to convert Gen patches into compiled code that will run faster than an interpreter like LibPd.

Am I right here? Can someone correct me if I wrong?

Thanks.

Pascal

woyteg's icon

Since you haven't had a lot of response I'll just say, yes that definitely sounds correct, but I'm not sure about the details, especially

therefore it is (or behaves like) a real-time interpreter for PureData patches

but it seems to be like that.

pascal2000's icon

Thanks.

Cheers.

automatized's icon

you can test my app to run and edit pd patches on iPad
textsound https://itunes.apple.com/us/app/textsound/id500491526?l=es&ls=1&mt=8