pulseCurve

maelzel.distribute.pulseCurve(curve, n, resolution=5, entropy=0.0, x0=None, x1=None)[source]

Generates a list of 0s/1s of length n, following the curve

For a resolution of 4, this is how some values are represented:

0    --> 0000
1    --> 1111
0.5  --> 0011
0.25 --> 0001
0.33 --> 0001
Parameters:
  • curve (BpfInterface) – a bpf or a function defined between 0 and 1

  • n (int) – the number of values to generate

  • resolution – how many rendered values represent a value of the curve. In fact, the bit-rate values will be rounded to the nearest lower representable value

  • entropy – a value between 0 and 1. Nearer to 0, the pulse representation is unmodified, nearer to 1, the numbers representing the pulse are shuffled. Imagine how to represent 0.5 with a resolution of 4, 0.5 –> 0011 With increasing entropy, this representation yields other shuffles: 0.5 –> 0101 or 1001 or 1010 …

  • x0 (Optional[float]) – the range to evaluate the curve. If a bpf is passed, its bounds are used as defaults. If a normal function is passed, these values default to 0, 1

  • x1 (Optional[float]) – the range to evaluate the curve. If a bpf is passed, its bounds are used as defaults. If a normal function is passed, these values default to 0, 1

Return type:

list[int]

Returns:

a seq. of 0s and 1s of length n