this is a quick explanation of the role of abstractions in pd, and why it is useful to use $0, $1, etc.. inside these abstractions.
ok. say you want to create a very simple sample player. you'd do something like this.
[0] <-- gui bang object #1
What is an abstraction, and why use $0, $1, etc ??
this is a quick explanation of the role of abstractions in pd, and why it is useful to use $0, $1, etc.. inside these abstractions.
ok. say you want to create a very simple sample player. you'd do something like this.
[0] <-- gui bang object #1
Hi, tanks for the tutorial, its help me very much!
Here let a Spanish translation I did. I hope someone serves.
http://www.hispasonic.com/blogs/03-abstracciones-pd-uso-signo/2770
Thank you very much again!
bang your brain
muchos gracias!
Here's how I've managed to send and receive from a parent(multi instance) abstraction to multiple instances of nested sub abstractions.
within main abstraction [mainAb]
some data named $0var send it like this
initialize sub abstractions
pass names X_1 and X_2 in so you can send and receive data to these abstractions individually
[abX X_1 $0] [abX X_2 $0]
within sub abstraction abX initialized with X_1
$1 = X_1
$2 = mainAb's $0
for all instances of abX
to receive from main's
[r $2var]
to to send and receive locally and have mainAb access
within abX
within mainAb [r $0X_1varZ] and [r $0X_2varZ]
a way to get global data to sub abstractions of abX
within abX initialize [abY $2var]
within abY $1var = mainAb $0var
This information is useful say if you have multiple voices and want to have them share the same control
so say $0var is a send on a filter frequency slider
when you move the slider all instances of abX receive the new filter frequency
when you want information to or from a specific instance of abX say like you want to plot each of the voices outputs on a scope
use [s~ $2$1varZ] in abX
then in main [r~ $0X_1varZ] and [r $0X_2varZ] then you can write those to a table so you can see which voice is sounding
Hi Mod
thanks for the nice example which I bumped into whilst looking around the forum. It's also interesting as I'd just read elsewhere on the forum a whole blurb on not using abstractions! If I find the discussion again I'll post the link here.
In the meanwhile .....
It would be nice (to finish your explanation) that you explain 'why' $1 $2 as, "$1, $2 ..etc is a bit easier to understand". Maybe for the non-beginner, but you could explain anyway, this way your tutorial would be 100% clear.
There also a very nice, and clear, explanation for anybody interested in the Floss Manual on PD producing a patch using $0 that spits out the random value each time you open the patch. It's in Chapter 38.Dollar Sign Arguments for anyone interested.
it might have been me that made that blurb
(in many situations, i'm not a big fan of abstractions, and i'd really much prefer if subpatches could use $0 locality like abstractions do.)
if you want to go ahead and edit/extend my explanation, then please do! just post the missing bits here, and i'll attach them to the original post.
Hi Mod (Maelstorm?)
You don't need to add on anything, you already wrote two excellent (and very clear) explanations here expanding on the why $0 and why then $1, $2 etc. :
http://puredata.hurleur.com/sujet-6417-dollar-signs-objects-messages
http://puredata.hurleur.com/sujet-6314-abstractions-problem
That's how I ended up here (on this thread).
I'll look out the other post as I can't see it at the moment.
ok cheers, just added those links to the tutorial.
I'm not Maelstorm, I just wish i was
Sorry Mod, as you can see in the links Maelstorm mentions your post, naturally I thought ..... wrongly.
Nice post though, thanks.
Hi mod,
Thanks for a very clear explanation. I got it now. There's something a bit weird going on when I use the [sample-playa] abstraction: every time I open a file, the table [$0-my-sample] appears on the parent patch as well. I placed 2 [sample-playa] abstractions in the parent patch and got two tables on it. Is it a bug or something?
Thanks!
i think my original patch here will play a different sample from each patch. If you want to play the same sample over a series of patches, then you need to make a global name for the sample array.
is that the issue?
if not, then post your patch with some annotation of the issue. and it should be easy to figure out
Hi mod,
I attach the patches (the ones you wrote in text format in the post)+ a photo of the vicious "bug". After you load an audio file, and right-click-open the abstraction, the table appears in the parent patch.. (I can't move it or delete it from there)...
well, there is an error in your patch, that it uses tabread4~ instead of tabplay~. but that's not the cause of the GUI issue.
yes, i think this is a bug. i have no idea why the table appears on your parent patch. hmmm.... it does not behave that way here. i wonder why it does that for you?
anyway, your patch uses a GUI array in the sample-playa abstraction, so how about if you change that to a non-GUI table?
Yes, you're right about the [tabread4~]...
and your suggestion works perfect! Thanks mod
Oops! Looks like something went wrong!