parse_rtm_syntax

rhythmtreetools.parse_rtm_syntax(rtm)

Parses RTM syntax.

Example 1. Parses tuplet:

>>> rtm = '(1 (1 (1 (1 1)) 1))'
>>> tuplet = rhythmtreetools.parse_rtm_syntax(rtm)
>>> tuplet
FixedDurationTuplet(Duration(1, 4), "c'8 c'16 c'16 c'8")
>>> show(tuplet) 

Example 2. Also supports fractional durations:

>>> rtm = '(3/4 (1 1/2 (4/3 (1 -1/2 1))))'
>>> tuplet = rhythmtreetools.parse_rtm_syntax(rtm)
>>> tuplet
FixedDurationTuplet(Duration(3, 16), "c'8 c'16 { 8/15 c'8 r16 c'8 }")
>>> show(tuplet) 

Returns fixed-duration tuplet or container.