3. Rests

3.1. Making rests from strings

You can make rests from a LilyPond input string:

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

3.2. Making rests from durations

You can make rests from durations:

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

3.3. Making rests from other Abjad leaves

You can also make rests from other Abjad leaves:

>>> note = abjad.Note("d'4..")
>>> rest = abjad.Rest(note)
>>> abjad.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 = abjad.MultimeasureRest('R1')
>>> abjad.show(multimeasure_rest)

Multiply the duration of multimeasure rests like this:

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

Use a LilyPond literal to compress full-bar rests:

>>> command = abjad.LilyPondLiteral(r'\compressFullBarRests')
>>> abjad.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 = abjad.Duration(3, 16)
>>> abjad.show(rest)