scamp.quantization.QuantizationScheme

class scamp.quantization.QuantizationScheme(measure_schemes: Sequence[MeasureQuantizationScheme], loop: bool = False)[source]

Bases: object

Scheme for quantizing a PerformancePart or Performance

Parameters:
  • measure_schemes – list of MeasureQuantizationSchemes to use

  • loop – if True, loops through the list of MeasureQuantizationSchemes; if False, keeps reusing the last MeasureQuantizationScheme given after it reaches the end of the list

Methods

beat_scheme_iterator()

Iterates through the beats of this QuantizationScheme, returning tuples of (beat_scheme, start_beat)

from_attributes([time_signature, ...])

Constructs a QuantizationScheme from some key attributes.

from_time_signature(time_signature[, ...])

Constructs a QuantizationScheme using a single time signature for the whole piece.

from_time_signature_list(time_signatures_list)

Constructs a QuantizationScheme using a list of time signatures

measure_scheme_iterator()

Iterates through the measures of this QuantizationScheme, returning tuples of (measure_scheme, start_beat)

classmethod from_attributes(time_signature: Optional[Union[str, TimeSignature, Sequence]] = None, bar_line_locations: Optional[Sequence[float]] = None, max_divisor: Optional[int] = None, max_divisor_indigestibility: Optional[float] = None, simplicity_preference: Optional[float] = None) QuantizationScheme[source]

Constructs a QuantizationScheme from some key attributes.

Parameters:
  • time_signature – either a time signature (represented in string form or as a TimeSignature object), or a list of time signatures. If a list, and the last element of that list is the string “loop”, then the list is repeatedly looped through; if not, the last time signature specified continues to be used.

  • bar_line_locations – a list of locations (in beats since the start of the performance) at which to place bar lines. Use either this parameter or the time_signature parameter, but not both.

  • max_divisor – the max divisor for all beats in the is measure (see BeatQuantizationScheme)

  • max_divisor_indigestibility – the max indigestibility for all beats in the is measure (see BeatQuantizationScheme)

  • simplicity_preference – the simplicity preference for all beats in the is measure (see BeatQuantizationScheme)

classmethod from_time_signature(time_signature: str | TimeSignature, max_divisor: int = 'default', max_divisor_indigestibility: float = 'default', simplicity_preference: float = 'default') QuantizationScheme[source]

Constructs a QuantizationScheme using a single time signature for the whole piece.

Parameters:
  • time_signature – the time signature to use (represented in string form or as a TimeSignature object)

  • max_divisor – the max divisor for all beats in the is measure (see BeatQuantizationScheme)

  • max_divisor_indigestibility – the max indigestibility for all beats in the is measure (see BeatQuantizationScheme)

  • simplicity_preference – the simplicity preference for all beats in the is measure (see BeatQuantizationScheme)

classmethod from_time_signature_list(time_signatures_list: Sequence, loop: bool = False, max_divisor: int = 'default', max_divisor_indigestibility: float = 'default', simplicity_preference: float = 'default') QuantizationScheme[source]

Constructs a QuantizationScheme using a list of time signatures

Parameters:
  • time_signatures_list – list of time signatures to use (represented in string form or as TimeSignature objects)

  • loop – if True, then the list of time signatures is repeatedly looped through; if not, the last time signature specified continues to be used.

  • max_divisor – the max divisor for all beats in the is measure (see BeatQuantizationScheme)

  • max_divisor_indigestibility – the max indigestibility for all beats in the is measure (see BeatQuantizationScheme)

  • simplicity_preference – the simplicity preference for all beats in the is measure (see BeatQuantizationScheme)

measure_scheme_iterator() Iterator[tuple[MeasureQuantizationScheme, float]][source]

Iterates through the measures of this QuantizationScheme, returning tuples of (measure_scheme, start_beat)

beat_scheme_iterator() Iterator[tuple[BeatQuantizationScheme, float]][source]

Iterates through the beats of this QuantizationScheme, returning tuples of (beat_scheme, start_beat)