Dynamically created sub-patchers/bpatches

Martin.Jirsak's icon

Hi all,

I would like to dynamically create a sub-patches/bpatches. How can I do this?

Lets' say I have a main window. I have a menu with 3 items in it. Choosing every single item would open (visually) the window and it will contain the same parameters, but for different layer. So I need to keep the parameters independent.

In this case, I can make 3 the very same sub-patchers and do everything static.

But the question is, how can I do it, if the number of the layers (items in the menu) would be dynamic? Then I want to make these sub-patchers dynamically. I don't expect I would need to create all objects and connections via scripting. I believe I can somehow just instantiate the same sub/b-patcher and use the only one source.

How to do this, please?

I attached small example with the static 3 layers, if it's not clear from my description.

Thanks in advice

Max Patch
Copy patch and select New From Clipboard in Max.

Frans-Jan Wind's icon

You can dynamically create any object with javascript. This could be a bpatcher which on itself loads a patch with an embedded javascript of its own. Within this embedded javascript you could create another bpatcher, which loads another patch with an embedded javascript.

Something like patchception :-)

Martin.Jirsak's icon

Hi,

Thank you for the reply.

How can I load the other patch to the bpatcher by using javascript, please?

double_UG's icon

perhaps you can use poly~ and route your parameters to different voices

Frans-Jan Wind's icon

Unzip and open create_bpatchers.maxpat Using the [incdec] the javascript will create the chosen amount of bpatchers.

bpatchers.zip
application/zip 2.92 KB

Martin.Jirsak's icon

Wow, very nice, FRANS-JAN WIND! Thank you very much!

Roman Thilenius's icon


the other three methods would be thispatcher-scripting, pcontrol, or using an OSX shell.

Martin.Jirsak's icon

Hi,

Thank you Roman Thilenius. The pcontrol way is the one I developed before Frans-Jan Wind sent his solution. It works quite well too.

Because I prefer to open the controllers in the new window, I will probably go this way at the end.

Thanks!