Class: Musa::MusicXML::Builder::Internal::Rest
- Defined in:
- lib/musa-dsl/musicxml/builder/rest.rb
Overview
Rest (silence) with specified duration or full measure.
Rest represents musical silence. It extends Note with rest-specific features, particularly the measure rest attribute for whole-measure silences.
Types of Rests
Regular Rests
Rests with explicit duration and type (whole, half, quarter, eighth, etc.):
Rest.new(duration: 4, type: 'half')
Rest.new(duration: 1, type: 'sixteenth', dots: 1)
Measure Rests
Full-measure rests that automatically fill the entire measure regardless of time signature:
Rest.new(duration: 8, type: 'whole', measure: true)
The measure: true attribute tells notation software to center the rest
and adjust its appearance based on the time signature.
Dotted Rests
Like notes, rests can have augmentation dots:
Rest.new(duration: 3, type: 'quarter', dots: 1) # Dotted quarter
Rest.new(duration: 7, type: 'half', dots: 2) # Double-dotted half
Multi-Voice Rests
In polyphonic music, rests can be assigned to specific voices:
Rest.new(duration: 2, type: 'quarter', voice: 2)
Usage
Created via Measure#add_rest or Measure#rest:
measure.rest duration: 4, type: 'half'
measure.add_rest duration: 8, type: 'whole', measure: true
Instance Method Summary collapse
-
#measure ⇒ Object
Measure rest builder/setter.