If I want to work with an array within an abstraction and make it strictly local naming the array $0-my-table or such, it won't work when actually using the abstraction and I continously receive: "error: 0-my-table: no such table"
What am I missing?
$0-my array or using $0 in array names
If I want to work with an array within an abstraction and make it strictly local naming the array $0-my-table or such, it won't work when actually using the abstraction and I continously receive: "error: 0-my-table: no such table"
What am I missing?
Thanks, that's it!
Hi all, I realized my central problem was that I was using an abstraction within an abstraction. This is not really a problem, but if you are using $0 on the parent abstraction, and want to still use those same objects $0-labeled within the 'daughter' abstraction, then one must transfer the $0 value from the parent to the daughter (this is not a biology lesson), since using $0 in the daughter abstraction will create a different random number than $0 in the parent.
I finally converted the daughter abstraction into a proper subpatch so that $0 is automatically shared. I would like to know, in any case, if I want to nest indefinitely abstractions within abstractions, how I can transfer the parent $0 value to the other ones. How do you guys approach this scenario?
For those interested, here is the grain synth (based on Andy farnell's work) I've been having troubles with. The parent abstraction is called granular3.pd, and the daughter grainvoice.pd
Hi cacosomoza,
The parent-daughter analogy you described is actually a pretty common way of messaging between multiple abstractions whilst keeping the whole patch local.
If you want to go further, just use $1 instead of $0 inside your child abstractions. For example:
I try to then use the following convention when naming sends/receives/tables
In the parent patch: all names are preceded with '$0-', i.e. $0-tableName
The 1st argument of every single abstraction should be $0 (if it's instantiated in the top level parent patch) or $1 (if it's one or more levels down from the parent patch.
In the abstractions: all names are preceded with '$1-', i.e. $1-tableName
Then if I want to access a table, declared in the parent patch, named '$0-tableName' from within an abstraction I can use '$1-tableName'. Also remember it's quite easy to make some annoying bugs (of the WTF!?! variety) where you forget to change to $0 or vice-verse when copying a name 
Hello! Despite following your instructions I'm having problems with using $0. I followed your instructions in my sub-patch 'lad', but I still get the "no 0-chL" error. Please help! I've not been using PD for very long, so I may have made a very silly mistake. pd 1a is supposed to send a sound file to be rendered in lad. I've attached the .pd files.
Your attachment didn't work. Make sure you don't preview the post when you add attachments or they will disappear.
That's funny, that's the third time I've uploaded it. I'm on Safari (Mac) I that helps. I'll put it on Dropbox and post the link later. Thanks for the quick reply, by the way!
Here it is again. Hopefully it'll work this time, it's now only 2.5mb rather than 6mb. It's only that big because of the 22 second sample... If this doesn't work I'll dropbox it.
EDIT: Got rid of the sample. You'll have to substitute the message in pd 1a if you want to test it.
http://www.pdpatchrepo.info/hurleur/ArduiContPD-No_Samples.zip
The [tabread4~]s should have $0, not $1. The $0 will work fine in object boxes.
I'm afraid that I'm still getting exactly the same error despite renaming them... Is it something to do with the message "read -resize $1 $0-chL $0-chR"? Thanks for your continued help!
Yeah. Change it to this:
[inlet]
|
[pack f $0]
|
[read -resize $1 $2-chL $2-chR(
Message boxes do not expand $0, so you should never use it in message boxes. $0 only works in objects, so you should instantiate them in object boxes and pass them to message boxes. In this example, [pack f $0] makes a list of the value from [inlet] and the $0 of the abstraction. The message box then replaces $1 with the first element of the list (the value from [inlet]) and replaces $2 with the second element ($0 of the abstraction).
You might want to read this for a further explanation:
http://puredata.hurleur.com/sujet-5853-abstraction-why-use-etc
Hello! It seems like that fix worked, but now I'm getting a different error when I send the symbol filename:
"pack_symbol: wrong type"
I tried changing pack f $0 to pack s f $0, but whenever I tried that, I got the "0-chL doesn't exist" error.
I'm quite glad that I managed to spot the deal with read, though! Looks like I'm getting better now! 
Thanks for any more help, and sorry for asking a lot of questions.
Sorry, I screwed that up. It should be [pack s $0]. You don't need that extra f.
Don't worry, we all screw up. Anyway, it works brilliantly now, I'll upload the subpatch later for general use. Thanks so much! I'll post the full patch when it's completed, too!
Oops! Looks like something went wrong!