Class: Musa::MusicXML::Builder::Internal::Rest

Inherits:
Note
  • Object
show all
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

Examples:

Quarter rest

Rest.new(duration: 2, type: 'quarter')

Measure rest (whole measure)

Rest.new(duration: 8, type: 'whole', measure: true)

Dotted eighth rest

Rest.new(duration: 3, type: 'eighth', dots: 1)

Rest in specific voice

Rest.new(duration: 4, type: 'half', voice: 2)

Rest with fermata

Rest.new(duration: 8, type: 'whole', fermata: true)

See Also:

Instance Method Summary collapse

Instance Method Details

#measure(value) ⇒ Object #measure=(value) ⇒ Object

Measure rest builder/setter.

Indicates whether this is a full-measure rest.

Overloads:

  • #measure(value) ⇒ Object

    Sets measure rest via DSL

    Parameters:

    • value (Boolean)

      true for measure rest

  • #measure=(value) ⇒ Object

    Sets measure rest via assignment

    Parameters:

    • value (Boolean)

      true for measure rest



191
# File 'lib/musa-dsl/musicxml/builder/rest.rb', line 191

attr_simple_builder :measure