scamp.quantization.MeasureQuantizationScheme¶
-
class
scamp.quantization.
MeasureQuantizationScheme
(beat_schemes: Sequence[scamp.quantization.BeatQuantizationScheme], time_signature: Union[scamp.quantization.TimeSignature, str], beat_groupings: Sequence = 'auto')[source]¶ Bases:
object
Scheme for quantizing a measure, including beat lengths and which beat divisors to allow.
- Parameters
beat_schemes – list of BeatQuantizationSchemes for each beat in the measure
time_signature – a TimeSignature or string representing a time signature for this measure
beat_groupings – a (potentially nested) list/tuple representing how beats come together to form larger groupings. For instance, in 4/4 time the beat_groupings will default to (2, 2).
Methods
from_time_signature
(time_signature[, …])Constructs a MeasureQuantizationScheme from a time signature.
get_beat_hierarchies
(subdivision_length)Generates a list of hierarchies representing how nested a subdivision is within the metric structure.
-
classmethod
from_time_signature
(time_signature: Union[scamp.quantization.TimeSignature, str, float], max_divisor: int = 'default', max_divisor_indigestibility: float = 'default', simplicity_preference: float = 'default') → scamp.quantization.MeasureQuantizationScheme[source]¶ Constructs a MeasureQuantizationScheme from a time signature. All beats will follow the same quantization scheme, as dictated by the parameters.
- Parameters
time_signature – Either a TimeSignature object or something that can be interpreted as such (e.g. a string to parse as a time signature, a measure length)
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
)
-
get_beat_hierarchies
(subdivision_length: float) → Sequence[int][source]¶ Generates a list of hierarchies representing how nested a subdivision is within the metric structure. For instance, if called on a 4/4 measure, with subdivision_length, 0.5, this will return the list [0, 3, 2, 3, 1, 3, 2, 3], showing that the first subdivision (downbeat) is the strongest, the 5th (3rd beat) is one level down, etc.
- Parameters
subdivision_length – length (in quarter notes) of the subdivision