Class: Musa::MusicXML::Builder::Internal::Note Abstract
- Extended by:
- Extension::AttributeBuilder
- Includes:
- Extension::With, Helper, ToXML
- Defined in:
- lib/musa-dsl/musicxml/builder/note.rb
Overview
Subclass and override #specific_to_xml to implement.
Abstract base class for all note types.
Note is the foundation for pitched notes, rests, and unpitched percussion notes. It provides comprehensive support for musical notation including:
Core Note Properties
- Duration and Type: Timing (duration in divisions, type: whole/half/quarter/etc.)
- Voice and Staff: Multi-voice and multi-staff support
- Dots: Dotted and double-dotted notes
- Grace Notes: Ornamental notes without duration
- Cue Notes: Smaller notes for reference
- Chords: Notes that sound simultaneously
Notations
The <notations> element groups musical symbols attached to notes:
Basic Notations
- Ties/Tied: Visual ties connecting notes (tie) vs sustained sound (tied)
- Slurs: Phrase markings
- Tuplets: Irregular rhythmic groupings (triplets, quintuplets, etc.)
- Dynamics: Volume markings (pp, p, mp, mf, f, ff, etc.)
- Fermata: Pause/hold symbols
- Accidental Marks: Sharp, flat, natural annotations
- Arpeggiate: Rolled chord indication
- Glissando/Slide: Pitch glide
Articulations
Attack and release characteristics:
- accent: Emphasis (>)
- staccato: Short, detached (•)
- tenuto: Full value (−)
- staccatissimo: Very short (▼)
- spiccato: Bouncing bow
- strong_accent: Forceful (^)
- detached_legato: Portato
- breath_mark: Breath pause
- caesura: Railroad tracks (caesura)
- Plus: doit, falloff, plop, scoop, stress, unstress
Ornaments
Melodic decorations:
- trill_mark: Rapid alternation with upper neighbor
- mordent: Single alternation with lower neighbor
- inverted_mordent: Single alternation with upper neighbor
- turn: Four-note figure around main note
- inverted_turn: Inverted turn figure
- delayed_turn: Turn after main note
- shake: Extended trill
- tremolo: Rapid repetition (single) or alternation (start/stop)
- schleifer: Slide ornament
- wavy_line: Trill extension
Technical Markings
Performance technique indicators:
String Instruments:
- fingering: Finger numbers
- up_bow/down_bow: Bowing direction (↑/↓)
- harmonic: Natural or artificial harmonics
- open_string: Open string indication (○)
- stopped: Stopped note (+)
- snap_pizzicato: Bartók pizzicato
- thumb_position: Cello thumb position
- string: String number
- hammer_on/pull_off: Legato technique
Wind Instruments:
- double_tongue/triple_tongue: Tonguing technique
- fingernails: Use fingernails
- hole: Woodwind fingering holes
Guitar/Fretted:
- fret: Fret number
- bend: String bend
- tap: Tapping technique
- pluck: Plucking style
Other:
- arrow: Directional arrow
- handbell: Handbell technique (damp, echo, gyro, etc.)
- heel/toe: Organ pedal technique
Hierarchy
Note is an abstract base class with three concrete subclasses:
- PitchedNote: Notes with specific pitch (step, octave, alteration)
- Rest: Silences with duration
- UnpitchedNote: Percussion notes without specific pitch
Usage
Note is not used directly—use PitchedNote, Rest, or UnpitchedNote. Notes are typically added via Measure convenience methods:
- Measure#add_pitch / Measure#pitch
- Measure#add_rest / Measure#rest
- Measure#add_unpitched / Measure#unpitched
Direct Known Subclasses
Class Method Summary collapse
-
.attr_complex_adder_to_array(name, klass, plural: nil, variable: nil) ⇒ Object
extended
from Extension::AttributeBuilder
Creates methods for adding complex objects (with multiple parameters) to an array.
-
.attr_complex_adder_to_custom(name, plural: nil, variable: nil) { ... } ⇒ Object
extended
from Extension::AttributeBuilder
Creates methods for adding complex objects with custom construction logic.
-
.attr_complex_builder(name, klass, variable: nil, first_parameter: nil) ⇒ Object
extended
from Extension::AttributeBuilder
Creates a getter/setter DSL method for complex objects with multiple parameters.
-
.attr_simple_builder(name, klass = nil, variable: nil) ⇒ Object
extended
from Extension::AttributeBuilder
Creates a simple getter/setter DSL method for a single value.
-
.attr_tuple_adder_to_array(name, klass, plural: nil, variable: nil) ⇒ Object
extended
from Extension::AttributeBuilder
Creates methods for adding id/value tuples to an array collection.
-
.attr_tuple_adder_to_hash(name, klass, plural: nil, variable: nil) ⇒ Object
extended
from Extension::AttributeBuilder
Creates methods for adding id/value tuples to a hash collection.
-
.attr_tuple_builder(name, klass, variable: nil) ⇒ Object
extended
from Extension::AttributeBuilder
Creates a getter/setter DSL method for a single id/value tuple.
Instance Method Summary collapse
-
#with(*value_parameters, keep_block_context: nil, **key_parameters, &block) ⇒ Object
included
from Extension::With
Executes a block with flexible context and parameter handling.
Class Method Details
.attr_complex_adder_to_array(name, klass, plural: nil, variable: nil) ⇒ Object Originally defined in module Extension::AttributeBuilder
Creates methods for adding complex objects (with multiple parameters) to an array.
Supports both positional and keyword arguments when creating instances.
.attr_complex_adder_to_custom(name, plural: nil, variable: nil) { ... } ⇒ Object Originally defined in module Extension::AttributeBuilder
Creates methods for adding complex objects with custom construction logic.
The block receives parameters and should construct and add the object.
.attr_complex_builder(name, klass, variable: nil, first_parameter: nil) ⇒ Object Originally defined in module Extension::AttributeBuilder
Creates a getter/setter DSL method for complex objects with multiple parameters.
Supports optional first_parameter that's automatically prepended when constructing.
.attr_simple_builder(name, klass = nil, variable: nil) ⇒ Object Originally defined in module Extension::AttributeBuilder
Creates a simple getter/setter DSL method for a single value.
.attr_tuple_adder_to_array(name, klass, plural: nil, variable: nil) ⇒ Object Originally defined in module Extension::AttributeBuilder
Creates methods for adding id/value tuples to an array collection.
Similar to attr_tuple_adder_to_hash but stores items in an array instead of hash. Useful when order matters or duplicates are allowed.
.attr_tuple_adder_to_hash(name, klass, plural: nil, variable: nil) ⇒ Object Originally defined in module Extension::AttributeBuilder
Creates methods for adding id/value tuples to a hash collection.
Generates:
add_#{name}(id, parameter)→ creates instance and adds to hash#{plural}(**parameters)→ batch add or retrieve hash
.attr_tuple_builder(name, klass, variable: nil) ⇒ Object Originally defined in module Extension::AttributeBuilder
Creates a getter/setter DSL method for a single id/value tuple.
Instance Method Details
#with(*value_parameters, keep_block_context: nil, **key_parameters, &block) ⇒ Object Originally defined in module Extension::With
The _ parameter is special: when present, it signals "keep caller's context"
and receives self (the object) as its value.
Uses SmartProcBinder internally to handle parameter matching.
Executes a block with flexible context and parameter handling.