ditherCurve¶
- maelzel.distribute.ditherCurve(curve, numsamples, resolution=2)[source]¶
Sample curve applying dithering to smooth transitions
- Parameters:
curve (
BpfInterface
) – a curve defined between 0-numstates.numsamples (
int
) – the number of samples, determines also the size of the outputresolution – the number of values to average together to calculate the resulting curve. There is a tradeoff between x and y resolution
- Return type:
list
[int
]- Returns:
a list of ints representing the state at each time
Example
>>> import bpf4 >>> b = bpf4.linear(0, 0, 1, 2) >>> ditherCurve(b, 20) [0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 2, 2]