Hello, all. I've just started using pd, and haven't really gotten into the groove yet. One question to start with... in an abstraction I tried to create "send $1-channel-$2", but it seems what this does is substitute for the $1 and leave the $2 a literal "$2". Is this a bug or a feature, and does it have a workaround?
More broadly: since this doesn't work, it must not be idiomatic pd. What's the usual way to do this kind of thing? For context, I was building a little grid sequencer, where each cell has three parts: a "source" abstraction, a message box which the user edits, and a "sink", which handles the messages in various ways. And when the sink saw a particular kind of message, it wanted to pass some data along to that "$1-channel-$2", where $1 is the name of the sequencer (to allow multiple ones) and $2 is the channel this cell is on.
hi Eli,
i don't think this is necessarily the best way to do it, but in Pd, as in Max, $-variables only work when they appear at the beginning of symbols, so that, for instance, $1$2$3 expands to "arg1$2$3" (if the first arg is arg1), without expanding $2 etc.
To do multidimensional expansion, for instance, instr1-voice2-yada, make an "instr" abstraction and call it with "instr1". inside the abstraction, call a "voice" abstraction with $1-voice2" as argument. inside the voice abstraction, use "$1-yada" which will then expand to "instr1-voice2-yada". Continue to any depth desired...
cheers Miller
On Tue, May 28, 2002 at 09:49:01PM -0400, eli+@gs211.sp.cs.cmu.edu wrote:
Hello, all. I've just started using pd, and haven't really gotten into the groove yet. One question to start with... in an abstraction I tried to create "send $1-channel-$2", but it seems what this does is substitute for the $1 and leave the $2 a literal "$2". Is this a bug or a feature, and does it have a workaround?
More broadly: since this doesn't work, it must not be idiomatic pd. What's the usual way to do this kind of thing? For context, I was building a little grid sequencer, where each cell has three parts: a "source" abstraction, a message box which the user edits, and a "sink", which handles the messages in various ways. And when the sink saw a particular kind of message, it wanted to pass some data along to that "$1-channel-$2", where $1 is the name of the sequencer (to allow multiple ones) and $2 is the channel this cell is on.
-- Eli Brandt | eli+@cs.cmu.edu | http://www.cs.cmu.edu/~eli/
Hi all, hi Miller
It would be great, if there will be equivalent $-sign to A_GIMME for messages and objects. I think, many externals could be replaced with this feature. e.g: if you want to "prepend" a 0 to a list, you have to write into a message-box: "0 $$" ; but maybe you need also equivalent $-signs to "argv" and "argc", like $v and $c, or $$ and $n . Some list-operating externals also need a $$. For messages also usefull: $-1 and $-2 a.s.o. the last argument and the argument before .....
What do you think about this ????
cheers Thomas.
hi Thomas,
that would be great indeed, as it would have taken the burden of memory allocation dilemmas from external developers' shoulders, and put it on Miller's...
:-)
Krzysztof
Thomas Musil wrote: ...
It would be great, if there will be equivalent $-sign to A_GIMME for messages and objects. I think, many externals could be replaced with this feature. e.g: if you want to "prepend" a 0 to a list, you have to write into a message-box: "0 $$" ;
...
What do you think about this ????
HI all,
I've been thinking about this for some time, but in a more general context: I'd like to be able to make varargs abstractions. The next thing you'd need is some way to make indeterminate numbers of inlets/outlets ...
cheers Miller
On Wed, May 29, 2002 at 03:47:13PM +0200, Thomas Musil wrote:
Hi all, hi Miller
It would be great, if there will be equivalent $-sign to A_GIMME for messages and objects. I think, many externals could be replaced with this feature. e.g: if you want to "prepend" a 0 to a list, you have to write into a message-box: "0 $$" ; but maybe you need also equivalent $-signs to "argv" and "argc", like $v and $c, or $$ and $n . Some list-operating externals also need a $$. For messages also usefull: $-1 and $-2 a.s.o. the last argument and the argument before .....
What do you think about this ????
cheers Thomas.
To do multidimensional expansion, for instance, instr1-voice2-yada, make an "instr" abstraction and call it with "instr1". inside the abstraction, call a "voice" abstraction with $1-voice2" as argument. inside the voice abstraction, use "$1-yada" which will then expand to "instr1-voice2-yada". Continue to any depth desired...
Thanks, Miller. This will work if I code the literal "voice2" into the instr abstraction, I think? I wonder if there's a way to make the original plan work, which was to have an abstraction take two args and put them together into one word, "s $1-$2". Otherwise I have to make a "channel1" abstraction, a "channel2",... or maybe I'm missing the point.