Tutorial 5: Referencing Player Attributes🔗
You can set variables outside a player
pitches = P[0,1,2,3,4]
harmony = pitches + 2
print(pitches)
print(harmony)
p1 >> pluck(pitches)
p2 >> star(harmony)
If you set the duration of the second, it might not have the desired effect
It is possible for one player object to play exactly what another player is. To have one player follow another, just use the follow method:
You can explicitly reference attributes such as pitch or duration too:
Works for other attributes too
You can reference, and test for the current value
The == returns a 1 if True and a 0 if False
This allows you to do conditionals like
Or change it to a different amp by multiplying by 4
Chain multiple conditionals
Which is the same as