Hi,
Is there a way to scan a patch (and then it's child subpatches and theirs etc. etc.) and assign a unique consecutive number to each graphical object?
For example say I have 4 sliders in a patch I want to number them so that the labels now read say 001, 002, 003 and 004 and they now respond to messages sent to r-001, r-002,..etc. and they are now sending information on s-001, s-002,..etc. And also this patch calls upon an abstraction that has 3 toggles and I want them to be labelled, sending and receiving through 005, 006 and 007 etc. etc.
I want to know if I can automate this task so that I can apply it to patches I've already made.
I know I am probably re-inventing the wheel here but I want to do this in vanilla hopefully.
My goal is for any gui parameter to be able to modulate any other parameter (as long as they are of the same type) simply by typing two numbers into number boxes that will link them. A simple modulation matrix of sorts.
Cheers as always,
John.
Hi,
On Mon, Jul 26, 2010 at 05:15:58PM -0700, saint wrote:
Is there a way to scan a patch (and then it's child subpatches and theirs etc. etc.) and assign a unique consecutive number to each graphical object?
There are some Python-modules to access and edit .pd-files, maybe these can help. Another solution would be to write a wrapper abstraction for your GUIs, that adds a consecutive number by incerementing a global [value] on creation. Your can then replace all objects with a shell/perl/python/... oneliner from http://puredata.info/docs/tutorials/TipsAndTricks/
For example say I have 4 sliders in a patch I want to number them so that the labels now read say 001, 002, 003 and 004 and they now respond to messages sent to r-001, r-002,..etc. and they are now sending information on s-001, s-002,..etc. And also this patch calls upon an abstraction that has 3 toggles and I want them to be labelled, sending and receiving through 005, 006 and 007 etc. etc.
I want to know if I can automate this task so that I can apply it to patches I've already made.
I know I am probably re-inventing the wheel here but I want to do this in vanilla hopefully.
My goal is for any gui parameter to be able to modulate any other parameter (as long as they are of the same type) simply by typing two numbers into number boxes that will link them. A simple modulation matrix of sorts.
Why are you selecting GUI parameters for this? Updating GUIs is still a rather costly operation in Pd (maybe it's better with the 0.43 rewrite), and updating 20 GUIs that you don't even see because they are in a hidden subpatch sounds like a waste. Consecutive numbers don't sound too good to me either. The same logic module can get different receives in every parent patch, which I think is very confusing. And it doesn't work for abstractions at all!
In the rj library (http://github.com/rjdj/rjlib) almost all abstractions have globally accessable control parameters (but no GUIs) by using a sssad-based aproach and [u_dispatch] objects for handling inlet-controls. While this requires some discipline when writing abstractions, it's working pretty well.
Frank
On Tue, 27 Jul 2010, Frank Barknecht wrote:
Why are you selecting GUI parameters for this? Updating GUIs is still a rather costly operation in Pd (maybe it's better with the 0.43 rewrite),
There's no reason why it would be any faster.
It's not like anyone *really* wanted to speed it up. I'm still the only one to have ever claimed on pd-list to have hacked the Tk Canvas code to make it faster. I mean, if anyone else cared that much, I would have noticed big time.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
Okay Frank thanks for the tips.
I was thinking of wrapper abstractions but I think I'll just have to go the rjdj route. I've always been a bit perplexed by sssad, do you recommend examining the rjdj abstractions to learn?
About the subpatches though, I was under the impression if a subpatch was closed then it won't take up the usual graphical change overhead that it would if it was open?
Cheers for pointing me in the right direction.
John.
--- On Tue, 27/7/10, saint saintidle@yahoo.com wrote:
From: saint saintidle@yahoo.com Subject: Auto unique number tagging of gui objects To: "pd list" pd-list@iem.at, "Me" saintidle@yahoo.com Date: Tuesday, 27 July, 2010, 1:15 Hi,
Is there a way to scan a patch (and then it's child subpatches and theirs etc. etc.) and assign a unique consecutive number to each graphical object?
For example say I have 4 sliders in a patch I want to number them so that the labels now read say 001, 002, 003 and 004 and they now respond to messages sent to r-001, r-002,..etc. and they are now sending information on s-001, s-002,..etc. And also this patch calls upon an abstraction that has 3 toggles and I want them to be labelled, sending and receiving through 005, 006 and 007 etc. etc.
I want to know if I can automate this task so that I can apply it to patches I've already made.
I know I am probably re-inventing the wheel here but I want to do this in vanilla hopefully.
My goal is for any gui parameter to be able to modulate any other parameter (as long as they are of the same type) simply by typing two numbers into number boxes that will link them. A simple modulation matrix of sorts.
Cheers as always,
John.
On Tue, 27 Jul 2010, saint wrote:
I was thinking of wrapper abstractions
You can make an abstraction that pretends to just instantiate another abstraction, but instead loads it object-per-object and edits the patch while loading it. I haven't tried yet but I'm sure that it's doable.
You'd be doing things like [route hradio] to find the horizontal radiobuttons so that you would be replacing the $6 of its argument list. (This is after splitting the message so that "#X obj" and the x,y position are separated from the rest (considered as an anything-message).
Or else you can keep everything together and check that the $5 of the list equals "hradio" and if so you would be replacing $11.
You need to make a certain number of cases because the receive-symbol isn't always in the same position in the argument-list.
Anyway, you don't need any Python or Tcl to do that. Although I sometimes write Tcl programmes that read, write or modify Pd patches).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
Hi John,
On Tue, Jul 27, 2010 at 12:29:49PM -0700, saint wrote:
Okay Frank thanks for the tips.
I was thinking of wrapper abstractions but I think I'll just have to go the rjdj route. I've always been a bit perplexed by sssad, do you recommend examining the rjdj abstractions to learn?
Personally I think, they have a nice interface for remote and inlet control of abstraction parameters. But I have to say that, I patched it. :)
At the very base there are sssad (called u_sssad in rj) objects, but actually you never see them, because they are hidden in dispatcher [u_dispatch] objects. These dispatchers are used to translate messages to receivers.
An [u_dispatch $0 frequency] will translate a message like "frequency 440" to a "440" sent to a "$0-frequency" receiver by using:
[inlet] | [route $2] | | | [outlet] | [s $1-$2]
Non-matching messages are sent along. This way you can easily build your whole "method"-list for an abstraction as:
[inlet] | [u_dispatch $0 frequency] | [u_dispatch $0 volume] | [u_dispatch $0 timbre] ...
Usually the last inlet of an rj-abstraction is built up like that.
Now the smart part is this: I realised , that everything, that is controlled through this last dispatcher-inlet also is something, that will be useful to control remotely and to save to a file/messagebox/...
That's why I added a [u_sssad $2 $1] object to u_dispatch.pd as well. $2 would become "frequency" or "volume" so it's the name of the parameter, while $1 is the parent's $0, which by some more trickery is used to do local as well as global parameter control (this is made with [u_loader] and it is a bit more complicated to explain.)
Anyway in the end, to "sssadify" an abstraction in rj only requires these steps:
Then always use your abstraction with a unique first argument as a "tag". Remote control can be realised by sending messages like: "<name_of_abstraction>-MYTAG frequency 330" to a global sender called "RJ_SCENE_LOAD". saving is made by sending "save" to "RJ_SCENE_SAVE" which will make you receive messages on "RJ_SCENE" that later can be sent to RJ_SCENE_LOAD for restoring.
That's about it.
About the subpatches though, I was under the impression if a subpatch was closed then it won't take up the usual graphical change overhead that it would if it was open?
Actually GUI objects can take a lot of resources even when invisible, if you activate them too often. At RjDj we target low-performance CPUs, so we optimize patches a lot, and the first thing to do is to remove all debugging GUIs. (RjDj doesn't even show the Pd GUI.)
Frank
Thanks for taking the time to explain that stuff Frank. I think I've got a handle on it now, and I think it's perfect for me. Don't know why I've been so scared of it!
--- On Tue, 27/7/10, saint saintidle@yahoo.com wrote:
From: saint saintidle@yahoo.com Subject: Re: Auto unique number tagging of gui objects To: "pd list" pd-list@iem.at, "Me" saintidle@yahoo.com Date: Tuesday, 27 July, 2010, 20:29 Okay Frank thanks for the tips.
I was thinking of wrapper abstractions but I think I'll just have to go the rjdj route. I've always been a bit perplexed by sssad, do you recommend examining the rjdj abstractions to learn?
About the subpatches though, I was under the impression if a subpatch was closed then it won't take up the usual graphical change overhead that it would if it was open?
Cheers for pointing me in the right direction.
John.
--- On Tue, 27/7/10, saint saintidle@yahoo.com wrote:
From: saint saintidle@yahoo.com Subject: Auto unique number tagging of gui objects To: "pd list" pd-list@iem.at,
"Me" saintidle@yahoo.com
Date: Tuesday, 27 July, 2010, 1:15 Hi,
Is there a way to scan a patch (and then it's child subpatches and theirs etc. etc.) and assign a unique consecutive number to each graphical object?
For example say I have 4 sliders in a patch I want to number them so that the labels now read say 001, 002,
003
and 004 and they now respond to messages sent to
r-001,
r-002,..etc. and they are now sending information on
s-001,
s-002,..etc. And also this patch calls upon an abstraction that has
3
toggles and I want them to be labelled, sending and receiving through 005, 006 and 007 etc. etc.
I want to know if I can automate this task so that I
can
apply it to patches I've already made.
I know I am probably re-inventing the wheel here but I
want
to do this in vanilla hopefully.
My goal is for any gui parameter to be able to
modulate any
other parameter (as long as they are of the same
type)
simply by typing two numbers into number boxes that
will
link them. A simple modulation matrix of sorts.
Cheers as always,
John.