3. Rests

3.1. Making rests from strings

You can make rests from a LilyPond input string:

>>> rest = Rest('r8')
>>> show(rest)

3.2. Making rests from durations

You can make rests from durations:

>>> rest = Rest(Duration(1, 4))
>>> show(rest)

3.3. Making rests from other Abjad leaves

You can also make rests from other Abjad leaves:

>>> note = Note("d'4..")
>>> rest = Rest(note)
>>> show(rest)

3.4. Understanding the interpreter representation of a rest

>>> rest
Rest('r4..')

Rest tells you the rest’s class.

4.. tells you that the rest’s duration is equal to that of a doubly dotted quarter note.

3.5. Making multimeasure rests

Create multimeasure rests like this:

>>> multimeasure_rest = scoretools.MultimeasureRest('R1')
>>> show(multimeasure_rest)

Multiply the duration of multimeasure rests like this:

>>> attach(Multiplier(4), multimeasure_rest)
>>> staff = Staff([multimeasure_rest])
>>> show(staff)

Use a LilyPond command to compress full-bar rests:

>>> command = indicatortools.LilyPondCommand('compressFullBarRests')
>>> attach(command, staff)
>>> show(staff)

3.6. Getting and setting the written duration of rests

Get the written duration of rests like this:

>>> rest.written_duration
Duration(7, 16)

Set the written duration of rests like this:

>>> rest.written_duration = Duration(3, 16)
>>> show(rest)