home/ atoms/ renardo-pvar

Renardo's `Pvar` makes entire Patterns switch over time, enabling structural variation between cycles

While var() switches a single scalar value, Pvar switches between complete Patterns. Pvar([[0,1,2,3],[4,5,6,7]], 4) plays P[0,1,2,3] for 4 beats, then switches to P[4,5,6,7]. This enables large structural variations: different melodic phrases, different rhythms, even different degrees per section. Pvar is used where the note sequence itself should change every N bars. Pattern methods (.reverse(), .shuffle()) applied to a Pvar produce a new Pvar that applies the method to each underlying pattern. A common application is alternating verse/chorus note patterns with a single variable.

Examples

melody = Pvar([[0,2,4,7],[0,-1,2,5]], 8)   # alternates every 8 beats
p1 >> pluck(melody, dur=0.5)

Assessment

What is the difference between Pvar([[0,1],[4,5]], 4) and var([0,4], 4) when used as a degree argument? Give a use case where Pvar is necessary.

“class Pvar(TimeVar): """ A TimeVar that represents Patterns that change over time e.g. :: >>> a = Pvar([ [0,1,2,3], [4,5] ], 4) >>> print a # time is 0 P[0, 1, 2, 3] >>> print a # time is 4 P[4, 5]”
corpus · renardo-python-over-supercollider-foxdot-successor-with-buil · chunk 82