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

Constructor Details

#initialize(pizzicato: nil, measure: nil, grace: nil, cue: nil, chord: nil, duration: nil, tie_start: nil, tie_stop: nil, voice: nil, type: nil, dots: nil, accidental: nil, time_modification: nil, stem: nil, notehead: nil, staff: nil, accidental_mark: nil, arpeggiate: nil, tied: nil, tuplet: nil, dynamics: nil, fermata: nil, glissando: nil, non_arpeggiate: nil, slide: nil, slur: nil, accent: nil, breath_mark: nil, caesura: nil, detached_legato: nil, doit: nil, falloff: nil, other_articulation: nil, plop: nil, scoop: nil, spiccato: nil, staccatissimo: nil, staccato: nil, stress: nil, strong_accent: nil, tenuto: nil, unstress: nil, delayed_inverted_turn: nil, delayed_turn: nil, inverted_mordent: nil, inverted_turn: nil, mordent: nil, schleifer: nil, shake: nil, tremolo: nil, trill_mark: nil, turn: nil, vertical_turn: nil, wavy_line: nil, other_ornament: nil, ornament_accidental_mark: nil, arrow: nil, bend: nil, double_tongue: nil, down_bow: nil, fingering: nil, fingernails: nil, fret: nil, hammer_on: nil, handbell: nil, harmonic: nil, heel: nil, hole: nil, open_string: nil, other_technical: nil, pluck: nil, pull_off: nil, snap_pizzicato: nil, stopped: nil, string: nil, tap: nil, thumb_position: nil, toe: nil, triple_tongue: nil, up_bow: nil, &block) ⇒ Rest

Creates a rest.

For detailed parameter documentation, see Note#initialize

Examples:

Quarter rest

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

Whole measure rest

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

Dotted eighth rest in voice 2

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

Parameters:

  • measure (Boolean, nil) (defaults to: nil)

    measure rest (fills entire measure)

  • grace (Boolean, nil) (defaults to: nil)

    grace note (ornamental, no time value)

  • cue (Boolean, nil) (defaults to: nil)

    cue note (smaller, reference indication)

  • chord (Boolean, nil) (defaults to: nil)

    note is part of a chord (sounds with previous note)

  • duration (Integer, nil) (defaults to: nil)

    duration in division units

  • type (String, nil) (defaults to: nil)

    note type: 'whole', 'half', 'quarter', 'eighth', '16th', etc.

  • dots (Integer, nil) (defaults to: nil)

    number of augmentation dots (1 or 2)

  • voice (Integer, nil) (defaults to: nil)

    voice number for polyphonic music

  • staff (Integer, nil) (defaults to: nil)

    staff number for multi-staff instruments

  • tie_start (Boolean, nil) (defaults to: nil)

    start a tie to next note

  • tie_stop (Boolean, nil) (defaults to: nil)

    stop a tie from previous note

  • accidental (String, nil) (defaults to: nil)

    visual accidental: 'sharp', 'flat', 'natural', etc.

  • stem (String, nil) (defaults to: nil)

    stem direction: 'up', 'down', 'double', 'none'

  • pizzicato (Boolean, nil) (defaults to: nil)

    pizzicato attribute on note element

  • time_modification (TimeModification, Hash, nil) (defaults to: nil)

    tuplet ratio (e.g., 3:2 for triplets)

  • notehead (Notehead, Hash, nil) (defaults to: nil)

    notehead style and properties

  • tied (String, nil) (defaults to: nil)

    tied notation: 'start', 'stop', 'continue'

  • tuplet (Tuplet, Hash, nil) (defaults to: nil)

    tuplet bracket/number notation

  • slur (String, Hash, nil) (defaults to: nil)

    slur: 'start', 'stop', 'continue' or hash with attributes

  • dynamics (String, Array<String>, nil) (defaults to: nil)

    dynamics: 'pp', 'p', 'mp', 'mf', 'f', 'ff', etc.

  • fermata (Boolean, String, nil) (defaults to: nil)

    fermata: true, 'upright', 'inverted'

  • accidental_mark (String, nil) (defaults to: nil)

    accidental in notations: 'sharp', 'flat', 'natural'

  • arpeggiate (Boolean, String, nil) (defaults to: nil)

    arpeggio: true, 'up', 'down'

  • non_arpeggiate (String, nil) (defaults to: nil)

    non-arpeggio: 'top', 'bottom'

  • glissando (String, nil) (defaults to: nil)

    glissando: 'start', 'stop'

  • slide (String, nil) (defaults to: nil)

    slide: 'start', 'stop'

  • accent (Boolean, nil) (defaults to: nil)

    accent mark (>)

  • staccato (Boolean, nil) (defaults to: nil)

    staccato (•)

  • tenuto (Boolean, nil) (defaults to: nil)

    tenuto (−)

  • staccatissimo (Boolean, nil) (defaults to: nil)

    staccatissimo (▼)

  • spiccato (Boolean, nil) (defaults to: nil)

    spiccato

  • strong_accent (Boolean, String, nil) (defaults to: nil)

    strong accent (^): true, 'up', 'down'

  • detached_legato (Boolean, nil) (defaults to: nil)

    detached legato (portato)

  • breath_mark (Boolean, String, nil) (defaults to: nil)

    breath mark: true, 'comma', 'tick'

  • caesura (Boolean, nil) (defaults to: nil)

    caesura (railroad tracks)

  • doit (Boolean, nil) (defaults to: nil)

    doit

  • falloff (Boolean, nil) (defaults to: nil)

    falloff

  • plop (Boolean, nil) (defaults to: nil)

    plop

  • scoop (Boolean, nil) (defaults to: nil)

    scoop

  • stress (Boolean, nil) (defaults to: nil)

    stress

  • unstress (Boolean, nil) (defaults to: nil)

    unstress

  • other_articulation (String, nil) (defaults to: nil)

    custom articulation text

  • trill_mark (Boolean, nil) (defaults to: nil)

    trill

  • mordent (Boolean, nil) (defaults to: nil)

    mordent (lower neighbor)

  • inverted_mordent (Boolean, nil) (defaults to: nil)

    inverted mordent (upper neighbor)

  • turn (Boolean, nil) (defaults to: nil)

    turn

  • inverted_turn (Boolean, nil) (defaults to: nil)

    inverted turn

  • delayed_turn (Boolean, nil) (defaults to: nil)

    delayed turn

  • delayed_inverted_turn (Boolean, nil) (defaults to: nil)

    delayed inverted turn

  • shake (Boolean, nil) (defaults to: nil)

    shake

  • tremolo (String, nil) (defaults to: nil)

    tremolo: 'single', 'start', 'stop'

  • schleifer (Boolean, nil) (defaults to: nil)

    schleifer

  • wavy_line (Boolean, nil) (defaults to: nil)

    wavy line (trill extension)

  • vertical_turn (Boolean, nil) (defaults to: nil)

    vertical turn

  • other_ornament (Boolean, nil) (defaults to: nil)

    custom ornament

  • ornament_accidental_mark (String, nil) (defaults to: nil)

    ornament accidental: 'sharp', 'flat', 'natural'

  • fingering (Fingering, Hash, nil) (defaults to: nil)

    fingering indication

  • up_bow (Boolean, nil) (defaults to: nil)

    up bow (↑)

  • down_bow (Boolean, nil) (defaults to: nil)

    down bow (↓)

  • harmonic (Harmonic, Hash, nil) (defaults to: nil)

    harmonic

  • open_string (Boolean, nil) (defaults to: nil)

    open string (○)

  • stopped (Boolean, nil) (defaults to: nil)

    stopped note (+)

  • snap_pizzicato (Boolean, nil) (defaults to: nil)

    Bartók pizzicato

  • thumb_position (Boolean, nil) (defaults to: nil)

    cello thumb position

  • string (Integer, nil) (defaults to: nil)

    string number

  • hammer_on (String, nil) (defaults to: nil)

    hammer-on: 'start', 'stop'

  • pull_off (String, nil) (defaults to: nil)

    pull-off: 'start', 'stop'

  • double_tongue (Boolean, nil) (defaults to: nil)

    double tonguing

  • triple_tongue (Boolean, nil) (defaults to: nil)

    triple tonguing

  • fingernails (Boolean, nil) (defaults to: nil)

    use fingernails

  • hole (Hole, Hash, nil) (defaults to: nil)

    woodwind fingering hole

  • fret (Integer, nil) (defaults to: nil)

    fret number

  • bend (Bend, Hash, nil) (defaults to: nil)

    string bend

  • tap (String, nil) (defaults to: nil)

    tapping

  • pluck (String, nil) (defaults to: nil)

    plucking technique

  • arrow (Arrow, Hash, nil) (defaults to: nil)

    arrow indication

  • handbell (String, nil) (defaults to: nil)

    handbell technique: 'damp', 'echo', 'gyro', etc.

  • heel (Boolean, nil) (defaults to: nil)

    heel (organ pedal)

  • toe (Boolean, nil) (defaults to: nil)

    toe (organ pedal)

  • other_technical (String, nil) (defaults to: nil)

    custom technical text



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/musa-dsl/musicxml/builder/rest.rb', line 84

def initialize(pizzicato: nil, measure: nil,
               grace: nil, cue: nil, chord: nil,
               duration: nil, tie_start: nil, tie_stop: nil,
               voice: nil, type: nil, dots: nil,
               accidental: nil, time_modification: nil,
               stem: nil, notehead: nil, staff: nil,
               accidental_mark: nil, arpeggiate: nil,
               tied: nil, tuplet: nil,
               dynamics: nil, fermata: nil, glissando: nil, non_arpeggiate: nil,
               slide: nil, slur: nil,
               accent: nil, breath_mark: nil, caesura: nil,
               detached_legato: nil, doit: nil, falloff: nil,
               other_articulation: nil, plop: nil, scoop: nil,
               spiccato: nil, staccatissimo: nil, staccato: nil,
               stress: nil, strong_accent: nil, tenuto: nil, unstress: nil,
               delayed_inverted_turn: nil, delayed_turn: nil,
               inverted_mordent: nil, inverted_turn: nil,
               mordent: nil, schleifer: nil, shake: nil,
               tremolo: nil, trill_mark: nil, turn: nil,
               vertical_turn: nil, wavy_line: nil,
               other_ornament: nil, ornament_accidental_mark: nil,
               arrow: nil, bend: nil, double_tongue: nil, down_bow: nil,
               fingering: nil, fingernails: nil, fret: nil,
               hammer_on: nil, handbell: nil, harmonic: nil,
               heel: nil, hole: nil, open_string: nil,
               other_technical: nil, pluck: nil, pull_off: nil,
               snap_pizzicato: nil, stopped: nil, string: nil,
               tap: nil, thumb_position: nil, toe: nil,
               triple_tongue: nil, up_bow: nil,
               &block)

  @measure = measure

  super
end

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



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

attr_simple_builder :measure