Pfunc generates pattern values by calling a function, and Pkey cross-references values from an earlier key
Pfunc(func) creates a pattern whose next value is the result of evaluating func. This enables arbitrary computation per event (e.g., reading a global variable, querying a sensor value). Pkey(\keyName) copies the already-computed value from another key in the same Pbind event — used to make one parameter depend on another. For example, using Pkey(\harmonic).reciprocal * 0.3 for amplitude ensures higher harmonics are quieter, where \harmonic is another key in the same Pbind. These patterns enable expressive dependencies between event parameters that static arrays cannot capture.
Examples
Pbind(\midinote, 33, \harmonic, Pexprand(1, 80, inf).round, \amp, Pkey(\harmonic).reciprocal * 0.3)
— amplitude automatically scales down for higher partials.
Assessment
In a Pbind, you want the pan position to be the inverse of the frequency — lower frequencies on the left, higher on the right. Which pattern class do you use to reference the frequency value, and how would you map it to a -1 to 1 pan range?