@Fauveboy You can have more than one argument...... try $1 1.... $1 2 etc. and use the second argument ($2 inside the patch) to differentiate....
It looks like you are starting to get the hang of it........ let the fun commence!
David.
-
Polyphonic voice management using \[poly\]
-
@Fauveboy Whatever works for you. The more advanced approach is to put $0 to every send, receive, array, text and struct object so every patch and abstraction is always separated and will never interfere when you for example open the same patch twice. So with this approach everything is separated, because you use the $0 of each abstraction inside the abstraction, which is great.
But than how can the abstraction communicate with the main patch? The solution is to give the $0 via creation argument down to the abstraction. Than inside the abstraction you know the $0 of the abstraction and the $0 of the main patch.
For example when you have an array in the main patch which has $0 in its name, you can not access it from within the abstraction because $0 of the main patch is unknown. But you can give the $0 of the main patch as creation argument to the abstraction, so now you can access the array via $1 (if its the first argument) and everything is perfect.
Here is an example: dollar-zero.zip
-
I dont think I understand just yet? is there a chance you can make sense of my code does what you're saying apply to it? Im sure I just need to mull over the logic you're explain but it just hasnt clicked yet.grid2.pd gridSamplerptest.pd voicePTest.pd
when you say via the creation argument…is $0 the creation argument?
I need gridamplerPtest $0 to be 1 because it is coordinated with the grid interface hardware with zero does it not remain as a four digit number? -
@Fauveboy [someobject 15 13] <- 15 and 13 are the creation arguments of someobject. Yes, $0 is a four digit number.
-
@Fauveboy Here another demonstration: dollar-args.zip
-
Okay I think I've got this thank you very much. So...
In the main patch I havegrid2.pd
1st abstraction gridSamplerptest.pd takes the arg $0. (although if I want eight of these maybe I just give it a argument which is 1,2,3 etc?)…actually i would just copy and paste it 8 times
and they would have different $0 values inside them anyway….Inside gridSamplerPtest I use the $1 to use the $0 from the main patch.
in the load.sample subpatch in gridSamplerPtest I load a sample. although for some reason when I go to properties on the array I’m not sure why but it ignores the “$” for the $0-table,so I’m getting errors at the moment.
There are also send and receive objects in load.sample that take the arg $0 because i want these to be unique to this particular gridSamplerPtest abstraction. the more important of these send and receive objects send data of the sample length and phase position.
in gridSamplerPtest i also have the abstraction voicePtest "$0" maybe this is irrelvant if im using $0 inside it?. making thesvoicePTest.pd particular abstractions unique to this gridSamplerPtest $0
inside voicePtest I use tabread4 table$1. $1 will ensure that it reads the table in gridSamplerPtest subpatch load.sample (when its not giving me errors) hopefully.
The pitch will vary between simultaneous button presses of voicePTest $0 . I need to make sure that the result of the value sent to adjust the pitch in an individual abstraction doesn’t send to another abstraction outside it…so with some objects where i don’t need to receive data from gridsamplerPtest I use $0 again so it only sends data with the abstraction its in.
This should work if I can work out whats happening with $0-table?
another note i have. Previously when i gave gridSamplerPtest an argument it was a number that correlated to an x y cordiniate on the monome grid based interface hardware.
so gridSamplePtest 1 would get received by an object such as x = $1. but I guess I got to use a different method to relate the number of gridSamplerPtest the rows located on the grid….
-
@Fauveboy Yes, $0 unique within the abstraction..... and within the parent.
If you have made an abstraction [abstr 1 2 3 $0] then actually the $0 value from the parent will be given to any $4 in the abstraction (its the 4th argument)
In the abstraction you would have ...... $1=1 $2=2 $3=3 $4=1001 $0=1002 (for example).
So in the parent $0=1001 = $4 in the abstraction.Can you zip the whole patch again and post....... it is easier to unwrap then copy/paste/save/rename all the patches separately......
and I cannot find your $0-table........ in the 3 patches you have posted.The reason for the error in the table is that the $0 in the message [read -resize.........] is not $0 as an argument because it is in a message.
You need to pump the value into the message....I am sort of hoping this will be your Eureka! moment, now that you have learnt so much.......
David.
-
@Fauveboy Yes, you can use [abstraction 1], [abstraction 2] to distinguish different abstractions. And if you are very confident that you will never open up two instances of your patch at the same time, this would be enough. But if you open up two instances somewhere in the future, they will interfere with each other, if you have something like [send $1-something] inside the abstraction.
i use $0 all the time just to be sure and don't have to worry, but it is up to you. i would for example use [abstraction $0 1], [abstraction $0 2], if the abstractions would need to communicate with the main patch or each other. The important thing here is that every send, receive, text, array and struct get some $0, but this is only if you maybe open two instances at any time at once.
The other thing is that $-arguments in objects and messages work completely differently. As @whale-av just described while i am typing...
-
heres the patch in a zip file. im looking over it myself again after reading your messages just now. the $0-table is in the sub patch pd load.sample in the gridSampleptest abstraction grid 2.zip
-
just the lastest version of the patch here
-
it Works!
...is what to have a list of abstractions instead of copy and paste?....a bit like in c programming you can have an array and a for loop ?
-
@Fauveboy Usually just copy&paste. You can also create objects with dynamic patching, see https://forum.pdpatchrepo.info/topic/10813/collection-of-pd-internal-messages-dynamic-patching.
Also look at the [clone] object, which might be what you are looking for.
-
@Fauveboy Well that is good news...... having twisted my head right off my neck I thought this might work...... twisted.zip
but as you have it solved...... well done!A Eureka moment in all that?
Yes....... abstraction = sub-routine (in 1970's speak).......
David.
-
@ingox I dont see see anything appearing as clone object?
-
@Fauveboy apparently [clone] is not present in pd extended...
-
@Maelstorm Hi there, I came across this post today as I've just started using PD recently and polyphony has become a bit of a struggle. For that reason your patch was great one sense but it does pose some new challenges.
How does one add ADSR functions to all the voices at once? Or even how does one select different waveshapes? I can build monophonic versions of both of these but once I get to polyphony, I hit a wall. -
@matchboxyouth i would take a look at the help file from the clone object, it works well together with poly and with the "all" message you can send something to all instances. but it also works without clone, like in the poly synth example in 7.stuff/synth.
-
@Jona Thanks very much, will have a look now!
-
Just one other thing there, where can I find this 7.stuff/synth?
-
@matchboxyouth It's in thePd documentation...... along with loads of useful tutorials.....
Pd/doc/7.stuff/synth
David.