Hello,
I have a problem... I'm implementing a simple comb filter subpatch that I can re-use. The subpatch uses a delay line. My problem is that if I have multiple instances of the subpatch in a larger patch, I have a naming conflict with the delay lines because they all have the same name. Right now I'm saving my patch as comb~.pd and invoking it as an abstraction. Is there a way to get around my problem without copying and pasting the patch every time I want to use it?
Thanks, this is my first post!
Chadwick
Hi Chad.
You can use "$0-". PD will replace it with an id (number) that is
unique for each instance of the patch. For example you can name your delay line "$0-delay".
[delread $0-delay]
.....
[delwrite $0-delay]
etc.
If you create 2 instances of you patch you will get something like "1023-delay" and "1024-delay".
Note that this mechanism is not generic (that is $0 is replaced this way only at the beginning of a string, do not try "this-is-my-delay-number-$0") and it doesn't work, on purpose, inside messages.
You can find more about this in the HTML manual (which explains many basic concepts of PD). And there are examples in the tutorial patches too.
It is the only way to make a local variable in PD but it works nicely.
HTH,
Maurizio Umberto Puxeddu.
On Thu, 2003-01-02 at 22:58, Chad Wood wrote:
Hello,
I have a problem... I'm implementing a simple comb filter subpatch that I can re-use. The subpatch uses a delay line. My problem is that if I have multiple instances of the subpatch in a larger patch, I have a naming conflict with the delay lines because they all have the same name. Right now I'm saving my patch as comb~.pd and invoking it as an abstraction. Is there a way to get around my problem without copying and pasting the patch every time I want to use it?
Thanks, this is my first post!
Chadwick
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list
this is kind of a FAQ, but... put if you put $0 at the beginning of the delay name, it will be expanded to something instance-specific (eg $0-delay). so you can include lots of copies of the same abstraction, and in each one $0 will expand to a different number.
pix.
On Thu, 2 Jan 2003 15:58:38 -0600 "Chad Wood" chadwickw@mail.utexas.edu wrote:
Hello,
I have a problem... I'm implementing a simple comb filter subpatch that I can re-use. The subpatch uses a delay line. My problem is that if I have multiple instances of the subpatch in a larger patch, I have a naming conflict with the delay lines because they all have the same name. Right now I'm saving my patch as comb~.pd and invoking it as an abstraction. Is there a way to get around my problem without copying and pasting the patch every time I want to use it?
Thanks, this is my first post!
Chadwick
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list
Thanks to both of you for the reply... Knowing that tidbit will help me a lot. I don't mean to be posting faq's to the list, but I did look through the html tutorial before I asked... couldn't find anything on it. I'll look harder next time I suppose.
Chad
-----Original Message----- From: pd-list-admin@iem.kug.ac.at [mailto:pd-list-admin@iem.kug.ac.at]On Behalf Of pix Sent: Friday, January 03, 2003 3:14 PM To: pd-list@iem.kug.ac.at Subject: Re: [PD] subpatches and delay lines
this is kind of a FAQ, but... put if you put $0 at the beginning of the delay name, it will be expanded to something instance-specific (eg $0-delay). so you can include lots of copies of the same abstraction, and in each one $0 will expand to a different number.
pix.
On Thu, 2 Jan 2003 15:58:38 -0600 "Chad Wood" chadwickw@mail.utexas.edu wrote:
Hello,
I have a problem... I'm implementing a simple comb filter subpatch that I can re-use. The subpatch uses a delay line. My problem is that if I have multiple instances of the subpatch in a larger patch, I have a naming conflict with the delay lines because they all have the same name. Right now I'm saving my patch as comb~.pd and invoking it as an abstraction. Is there a way to get around my problem without copying and pasting the patch every time I want to use it?
Thanks, this is my first post!
Chadwick
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list
PD-list mailing list PD-list@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-list