Change argument called

hey little question is there a way to do this ?

Prand([\atk, \dec], 1)

I mean changing the argument called ?

=D

Not directly.

You can use a Pfunc to put something into the event, with a variable key, maybe like this:

p = Pbind(
    \key, Prand([\atk, \dec], 1),
    \value, Pwhite(0.1, 0.5),
    \fix, Pfunc { |ev| ev[ev[\key]] = ev[\value] }
)

Or maybe with the finish function:

p = Pbind(
    \key, Prand([\atk, \dec], 1),
    \value, Pwhite(0.1, 0.5),
    \finish, { ~key.envirPut(~value) }
)

(I think… I’m not at the computer now.)

hjh

1 Like

it works perfectly !!

I do a lot of… what it LOOKS like you’re doing - I’ll often use:

Pbind(
  \env, Prand([0, 1], inf),
  \atk, Pkey(\env),
  \dec, 1 - Pkey(\env)
)
1 Like

thanks Scott I also posted an example of what I do in the music section if you like to check

code are not really as mentioned anymore though hahaha moving fast