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/