onepulse

maelzel.distribute.onepulse(x, resolution, entropy=0.0)[source]

Represents x as a seq. of 0 and 1

Parameters:
  • x (float) – a float number between 0 and 1

  • resolution (int) – int. The number of pulses. NB: these are not binary bits, all bits have the same significance

  • entropy – (float, 0-1). 0: no entropy (the same output for a given input), > 0: output is shuffled, entropy represents the number of shuffles

Return type:

list[int]

Returns:

a list of 0s and 1s representing x

Example

>>> from maelzel import distribute
>>> distribute.onepulse(0.5, 5)
[1, 0, 1, 1, 0]