Object Oriented Programming in Max

evanlivingston's icon

I realize these questions have been raised before on this forum, however they are at least years old.

I'd like to have instances of a subpatcher created dynamically. For example, If I have a subpatcher that creates white noise, I might want to add another, or change the volume of one. I realize I could do this another way, however in my final patch I'd like to have up to fifty different subpatchers(instruments), which might be routed through five unique subpatchers each.

In a true object oriented language I could create a new object and change it's variables.

At the moment, what is the best way of dealing with this issue in Max? does anyone have any creative solutions?
Does this type of thing need to be done in another language?

Thanks,

Luke Hall's icon

If you create abstractions (max patches that you can reuse like any other object in other max patches) you can give them arguments using objects like [patcherargs]. You might also want to look at Mattijs Kneppers' oo objects which might be useful.

Mark Durham's icon

Thanks for asking this question, I've also been pondering this recently. I've been working on a patch which needs to call varying quantities of an effect chain and re-label the send and receives in that abstraction by number.

Just checked out the ideas which Luke suggested but they are a bit beyond my understanding at the moment. Presumably this is not a simple task and is this not possible using standard max objects? Would be grateful for any example patches if anyone has achieved this.

Mark

christripledot's icon

You might be able to get away with using [poly~]...

You can 'create' or 'destroy' instances using "mute" messages, and change the parameters of each voice using "target" messages...

Oh, you need sends~ and receives~... bugger. I know it was bad practice to use them in [poly~] in Max 5, but it's a shame this doesn't work in Max 6 anymore.

Timo Rozendal's icon

also check alex harker's dynamicdsp externals, these are really flexible (and also in other ways better than poly~)
For example: you can set the outputs dynamically