rtm¶
Rhythm tree functions.
Classes
- class evans.rtm.RhythmTreeQuantizer[source]¶
Attributes Summary
Call self as a function.
Special methods
Functions
- evans.rtm.flatten_tree_level(rtm, recurse=False)[source]¶
>>> string = "(1 (1 (1 ((2 (1 1 1)) 2 2 1))))" >>> rhythm_tree_container_ = evans.flatten_tree_level( ... string, ... recurse=False, ... ) >>> strings = [string, rhythm_tree_container_] >>> durations = [abjad.Duration(1, 1), abjad.Duration(1, 1)] >>> h = evans.RhythmHandler(evans.RTMMaker(strings), forget=False) >>> selections = h(durations) >>> staff = abjad.Staff() >>> staff.extend(selections) >>> abjad.show(staff)
>>> string = "(1 (1 (1 ((2 (1 1 1)) 2 2 1))))" >>> rhythm_tree_container_ = evans.flatten_tree_level( ... string, ... recurse=True, ... ) >>> strings = [string, rhythm_tree_container_] >>> durations = [abjad.Duration(1, 1), abjad.Duration(1, 1)] >>> h = evans.RhythmHandler(evans.RTMMaker(strings), forget=False) >>> selections = h(durations) >>> staff = abjad.Staff() >>> staff.extend(selections) >>> abjad.show(staff)
- evans.rtm.funnel_inner_tree_to_x(rtm_string, x=1)[source]¶
>>> rtm = "(1 (3 (2 (1 2 1 1)) 3))" >>> for x in evans.funnel_inner_tree_to_x(rtm_string=rtm, x=5): ... print(x) ... (1 (3 (2 (1 2 1 1)) 3)) (1 (4 (3 (2 3 2 2)) 4)) (1 (5 (4 (3 4 3 3)) 5)) (1 (5 (5 (4 5 4 4)) 5)) (1 (5 (5 (5 5 5 5)) 5))
>>> rtm_list = evans.funnel_inner_tree_to_x(rtm_string=rtm, x=5) >>> maker = evans.RTMMaker(rtm=rtm_list) >>> divisions = [abjad.Duration(1, 1) for _ in rtm_list] >>> selections = maker(divisions) >>> staff = abjad.Staff() >>> staff.extend(selections) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> file = abjad.LilyPondFile( ... items=[score], ... includes=["abjad.ily"], ... global_staff_size=16, ... ) >>> abjad.show(file)
>>> rtm_list = evans.funnel_inner_tree_to_x( ... rtm_string="(1 ((4 (1 1 (2 (3 1)))) 1))", x=1 ... ) >>> maker = evans.RTMMaker(rtm=rtm_list) >>> divisions = [abjad.Duration(1, 1) for _ in rtm_list] >>> selections = maker(divisions) >>> staff = abjad.Staff() >>> staff.extend(selections) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> file = abjad.LilyPondFile( ... items=[score], ... includes=["abjad.ily"], ... global_staff_size=16, ... ) >>> abjad.show(file)
- evans.rtm.nested_list_to_rtm(nested_list)[source]¶
>>> nested_list = [1, [1, 1, [1, [1, 1]], 1]] >>> rtm_string = evans.nested_list_to_rtm(nested_list) >>> print(rtm_string) (1 (1 1 (1 (1 1)) 1))
>>> rtm_list = [rtm_string] >>> maker = evans.RTMMaker(rtm=rtm_list) >>> divisions = [abjad.Duration(1, 1)] >>> selections = maker(divisions) >>> staff = abjad.Staff() >>> staff.extend(selections) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> file = abjad.LilyPondFile( ... items=[score], ... includes=["abjad.ily"], ... global_staff_size=16, ... ) >>> abjad.show(file)
- evans.rtm.rotate_tree(rtm_string, n=1)[source]¶
>>> rtm = "(1 (2 (1 (1 2)) 1))" >>> for x in range(6): ... new_rtm = evans.rotate_tree(rtm, x) ... print(new_rtm) ... (1 (2 (1 (1 2)) 1)) (1 (1 (1 (2 1)) 2)) (1 (1 (2 (1 2)) 1)) (1 (2 (1 (2 1)) 1)) (1 (1 (2 (1 1)) 2)) (1 (2 (1 (1 2)) 1))
>>> rtm_list = [evans.rotate_tree(rtm, x) for x in range(6)] >>> maker = evans.RTMMaker(rtm=rtm_list) >>> divisions = [abjad.Duration(1, 1) for _ in rtm_list] >>> selections = maker(divisions) >>> staff = abjad.Staff() >>> staff.extend(selections) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> file = abjad.LilyPondFile( ... items=[score], ... includes=["abjad.ily"], ... global_staff_size=16, ... ) >>> abjad.show(file)
>>> divisions = [ ... abjad.Duration(1, 2), ... abjad.Duration(1, 4), ... abjad.Duration(1, 4), ... abjad.Duration(1, 1), ... abjad.Duration(1, 4), ... abjad.Duration(3, 4), ... abjad.Duration(2, 1), ... abjad.Duration(5, 8), ... abjad.Duration(3, 8), ... ] >>> selections = maker(divisions) >>> staff = abjad.Staff() >>> staff.extend(selections) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> file = abjad.LilyPondFile( ... items=[score], ... includes=["abjad.ily"], ... global_staff_size=16, ... ) >>> abjad.show(file)
Rhythm-makers
- class evans.rtm.RTMMaker(rtm, tie_across_divisions=False)[source]¶
>>> rtm = ["(1 (1 1))", "(1 (1 1 1))", "(1 (1 1 1 1))"] >>> maker = evans.RTMMaker(rtm=rtm) >>> divisions = [abjad.Duration(1, 1), abjad.Duration(1, 1), abjad.Duration(1, 1)] >>> selections = maker(divisions) >>> staff = abjad.Staff() >>> staff.extend(selections) >>> score = abjad.Score([staff]) >>> moment = "#(ly:make-moment 1 25)" >>> abjad.setting(score).proportional_notation_duration = moment >>> file = abjad.LilyPondFile( ... items=[score], ... includes=["abjad.ily"], ... global_staff_size=16, ... ) >>> abjad.show(file)
Attributes Summary
Calls rhythm-maker.
Delegates to storage format manager.
Return str(self).
Special methods
Read-only properties
-
(
RhythmMaker
).previous_state¶ Gets previous state dictionary.
- Return type
OrderedDict
-
(
RhythmMaker
).state¶ Gets state dictionary.
- Return type
OrderedDict
-
(