Welcome to %s forums

BrainModular Users Forum

Login Register

subpatch changes in parent patch

General Discussion about whatever fits..
Post Reply
funkyguitarist
Member
Posts: 40
Contact:

Unread post by funkyguitarist » 08 May 2015, 16:06

hello
i can t find anything about it in the forum
so sorry if this has been asked before.

I have a patch that i use as a subpatch in other patches.
when i change this subpatch i thought it would also change in the parent patch when i
reload the parent patch. but that isn t the case. it seems like this particular instance of the patch is saved with the parent.
i thought that every instance of the patch is supposed to change.

new instances are changed of course

how can i achieve this

many thanks in advance


mark

shawnb
Member
Posts: 190
Location: San Francisco
Contact:

Unread post by shawnb » 08 May 2015, 21:19

Yes, the behavior you describe is correct. It would be nice if this were an option (e.g., embed vs link).

To make it dynamically grab the right one, you can use IML.

Instead of your subpatch, include a 'Send Internal Msg' module.
Give it some code, in the 'lines', e.g:
CREATE_MODULE george 6 300 300 mypatch.pat

'george' is the name of the module. '6' tells it to create a subpatch. 300 300 are the coordinates. mypatch.pat is the name of your previously saved .pat file, a copy of which now exists as the subpatch 'george'.

Problem now is connections. You can automate those too. And yes, this is work...
Address the process rather than the outcome. Then, the outcome becomes more likely. - Fripp

funkyguitarist
Member
Posts: 40
Contact:

Unread post by funkyguitarist » 09 May 2015, 15:55

hi shawnb
thank you for your response

your explanation sounds logical. but indeed then i have to connect the module programmatically
which i have no clue of how to do so, to be honest.
Is there any documentation you can point me to?
or some kind of a starting point?


cheers


mark

shawnb
Member
Posts: 190
Location: San Francisco
Contact:

Unread post by shawnb » 09 May 2015, 20:27

It's not that hard, actually. Two things you need to know first...

First is how to open the Console, so you can watch your code work (or not...) and debug it if necessary. HH supports some 'hidden strings', the most important one is 'console'. Mouse click on an unused portion of your workspace & type in the word 'console'. More on hidden strings here:
http://www.sensomusic.com/wiki3/doku.ph ... en_strings

Second is the IML page. The two commands that interest you most are CREATE_MODULE and CREATE_LINK. You'll find info on them here:
http://www.sensomusic.com/wiki3/doku.ph ... l_messages

The table of MODULE IDs at the bottom of the page is important, too.

CREATE_LINK needs to be passed the outputs (from's) & inputs (to's) you want to connect. You specify the module name & inlet name of each It can work with either the inlet names or #s, e.g., the first inlet is 0, the second is 1, etc.

*** The easiest way to do this is to do the connection in your patch, and look at the CREATE_LINK command that resulted in your console window!!!**** You know that will work. Then substitute friendly names where you can, e.g., 'george' and 'gain'.

An example...

Your intended subpatch is mysubpatch.pat, & it has two inputs, an audio in & a data in which you named "gain", and one audio output. You want to create a subpatch named George from it, and connect it to your patch's audio in, audio out and a fader for 'gain'. The 4 statements would need to look like this:

CREATE_MODULE george 6 300 300 mysubpatch.pat
CREATE_LINK 1 0 george 0
CREATE_LINK 2 1 george gain
CREATE_LINK george 2 3 0

The first line creates george
The second line connects FROM your patch's audio input to george's audio inlet
The third line connects FROM your fader to george's "gain" inlet
The fourth line connects FROM george's audio outlet to your patch's audio output
(Double quotes would be needed around strings with embedded spaces...)

Your module #s may be different, which is why you should do the connection & steal the 'CREATE_LINK' syntax from the console window.

Hope this helps,
Address the process rather than the outcome. Then, the outcome becomes more likely. - Fripp

shawnb
Member
Posts: 190
Location: San Francisco
Contact:

Unread post by shawnb » 09 May 2015, 20:50

Note #1 - You learn A LOT by watching the console window while editing your patches...

Note #2 on the above - you will get a lot of erroneous "Var not found" messages in the console window. If your CREATE_LINK works, ignore the messages.

Note #3 on the above - module & inlet names work great when you've named them. But you can't always rename them to something friendly. Sometimes you're just stuck using the module & inlet #s.

If anybody knows how to use friendly names, for example, for audio in modules & inlets, let me know. "Audio In" and "audio 1" don't work. I usually end up doing it manually once, then stealing the #s from the console window.

I'd feel more comfortable using names for everything - as you edit your patch, the module #s change...
Address the process rather than the outcome. Then, the outcome becomes more likely. - Fripp

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 20 Dec 2016, 21:08

I need to delete a subpatch before loading and cabling a different one. But when I open the console and delete the subpatch, it shows me nothing!!

So what is the IML for deleting something???
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 20 Dec 2016, 22:27

All the (documented) options are here http://www.sensomusic.org/wiki3/doku.ph ... l_messages
In the case of deleting something, DELETE_MODULE nameofmodule does the trick.

gurulogic
Member
Posts: 1019
Contact:

Unread post by gurulogic » 20 Dec 2016, 22:55

To try to expand a bit on what shawnb was explaining in response to funkyguitarist's OP, yes it is possible via IML to link/load a specific sub patch into any parent patch.

For example, I have a patch named BD1 that I want to load as a sub patch. In the send message module within the patch I want to load to, I would enter:

SET_TARGET_PATCH SENDER_PATCH
CREATE_MODULE BD1 6 100 100 'E:Usine LibraryFor IML LoadBD1.pat'

This will load the previously saved sub patch into the current patch. Where things get tricky, as I a novice at IML have learned is using the IML to wire everything into place. The easy option is to have all the i/o from the sub patch connect via bus so no additional wiring is necessary, but this is not always practical, especially as buses add latency.

I have been meaning to bring up in another topic to get a better in depth understanding, but it seems wiring pins of a sub patch via IML is not as straightforward as wiring the pins of a module. In some cases as shawnb was explaining, terminal (pins) names works, but in most cases it seems that terminal number is required, and the terminal numbers change when the i/o modules inserted in sub patch change.

One example for wiring via terminal names (modules being wired in parent patch must be assigned names, ie: IN1, IN2)
CREATE_LINK IN1 "audio 1" BD1 "audio 1"

One example for wiring via terminal number
CREATE_LINK IN1 0 BD1 1 (this is just a guess off the top of my head for terminal numbers ) if 0 and 1 being correct, real world may be different)

I think it could be good as a feature suggestion that a sub patch could have a setting to ether be linked or embedded. It would make this sort of functionality easier to access.

woodslanding
Member
Posts: 1327
Contact:

Unread post by woodslanding » 21 Dec 2016, 22:05

Okay, found it all and it is working nicely. Thanks for the explanation!
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify

Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests