scamp.quantization.BeatQuantizationScheme

class scamp.quantization.BeatQuantizationScheme(length: float, divisors: Sequence, simplicity_preference: float = 'default')[source]

Bases: object

Scheme for making a decision about which divisor to use to quantize a beat

Parameters:
  • length – In quarter-notes

  • divisors – A list of allowed divisors or a list of tuples of (divisor, undesirability). If just divisors are given, the undesirability for each will be calculated based on its indigestibility.

  • simplicity_preference – ranges 0 - whatever. A simplicity_preference of 0 means all divisions are treated equally; a 7 is as good as a 4. A simplicity_preference of 1 means that the error for a given divisor is weighted by that divisor’s indigestibility, and a simplicity_preference of 2 means the error is weighted by the indigestibility squared, etc.

Methods

from_max_divisor(length, max_divisor[, ...])

Takes a max divisor argument instead of a list of allowed divisors.

from_max_divisor_indigestibility(length, ...)

Takes a max_divisor and max_divisor_indigestibility to determine the list of divisors.

classmethod from_max_divisor(length: float, max_divisor: int, simplicity_preference: float = 'default') BeatQuantizationScheme[source]

Takes a max divisor argument instead of a list of allowed divisors.

Parameters:
  • length – In quarter-notes

  • max_divisor – The largest allowable divisor

  • simplicity_preference – Preference for simple divisors (see class description)

classmethod from_max_divisor_indigestibility(length: float, max_divisor: int, max_divisor_indigestibility: float, simplicity_preference: float = 'default') BeatQuantizationScheme[source]

Takes a max_divisor and max_divisor_indigestibility to determine the list of divisors.

Parameters:
  • length – In quarter-notes

  • max_divisor – The largest allowable divisor

  • max_divisor_indigestibility – sets a hard limit on the indigestibility of divisors that we will consider, in contrast to simplicity_preference, which simply penalizes indigestible divisors. (See Clarence Barlow’s writing on indigestibility.)

  • simplicity_preference – Preference for simple divisors (see class description)