Constants

A constant is an unchanging value i.e. cannot be manipulated through mathematical operations. To create one, simply use the const constructor and the value you want to keep constant:

>>> value = const(10)
>>> print(value + 4)
10
>>> print(value * 100)
10
>>> print(value / 99)
10

These can be really useful for shifting entire sequences of values except one or two:

p1 >> pluck([0, 4, const(7), const(6)], dur=1/2) + var([0, -2, -4])

Constants can also be used in a PGroup to create constant notes in moving chord sequences:

p1 >> pluck(var([0, -3, -2, -4], 4), dur=1/2) + (0, 2, const(4))