Envelope Shorthand ================== *Example script* (scamp): `examples/Tutorial/15_envelope_shorthand.py `__ *Download:* :download:`15_envelope_shorthand.py ` Plays two glissandi by passing lists instead of envelopes to the pitch argument of play_note. *Topics:* :doc:`Pitch › Glissando `, :doc:`Envelopes › As note parameters ` .. raw:: html
score
.. raw:: html
.. code-block:: python from scamp import * s = Session() viola = s.new_part("viola") s.start_transcribing() # a list of values results in evenly spaced glissando viola.play_note([60, 70, 55], 1.0, 4) # a list of lists can give values, durations, and (optionally) curve shapes # this results in segment durations of 2 and 1 and curve shapes of -2 and 0 # NB: by default, envelopes created through list shorthand like this are # resized to the duration of the note, whereas Envelope objects passed directly # are not. So in this case, the durations of 2 and 1 get scaled up to 8/3 and 4/3 # so that the whole envelope lasts 4 beats (the duration of the note). # You can change this behavior so that it resizes for Envelope objects as well, # or so that it never resizes, by altering playback_settings.resize_parameter_envelopes viola.play_note([[60, 70, 55], [2, 1], [-2, 0]], 1.0, 4) performance = s.stop_transcribing() performance.to_score().show()