Simplified Quantization ======================= *Example script* (scamp): `examples/Tutorial/09_simplified_quantization.py `__ *Download:* :download:`09_simplified_quantization.py ` Same as last example except that we see two different levers for simplifying the notation: `max_divisor` (which defaults to 8) sets a hard cap on how finely we can divide the beat. `simplicity_preference` (which defaults to 2), rather than setting a hard cap, amplifies the error calculation for complicated divisors, leading to simpler beat divisions unless the complicated division is a very good match. *Topics:* :doc:`Notation & engraving › Quantization ` .. raw:: html
Default Quantization
score
.. raw:: html
Max Divisor of 4
score
.. raw:: html
Strong Simplicity Preference
score
.. raw:: html
.. code-block:: python from scamp import * import random # fixed random seed for reproducibility random.seed(47) s = Session() violin = s.new_part("Violin") # begin recording s.start_transcribing() for _ in range(2): # loop twice for pitch in [60, 64, 67, 72]: dur = random.uniform(0.5, 1.5) violin.play_note(pitch, 1, dur) if random.random() < 0.5: # note that "wait" is the same here as "s.wait". What "wait" does it find the # clock operating on the given thread and call wait on that. In this case, that # clock is the Session as a whole. wait(random.random()) performance = s.stop_transcribing() # first show the score with the default quantization settings performance.to_score(time_signature="3/4", title="Default Quantization").show() # now try it again imposing a max divisor of 4 this time performance.to_score(time_signature="3/4", max_divisor=4, title="Max Divisor of 4").show() # finally, try it with a higher max divisor, but a strong simplicity_preference performance.to_score(time_signature="3/4", simplicity_preference=3, title="Strong Simplicity Preference").show()