Class: Musa::MusicXML::Builder::Internal::PitchedNote Private

Inherits:
Note
  • Object
show all
Defined in:
lib/musa-dsl/musicxml/builder/pitched-note.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Pitched note with specific step, octave, and optional alteration.

PitchedNote represents notes with defined pitches (as opposed to rests or unpitched percussion). It extends Note with pitch information: step (C-G), octave (scientific pitch notation), and optional chromatic alteration.

Pitch Components

Step

The diatonic pitch class: 'C', 'D', 'E', 'F', 'G', 'A', 'B'

Octave

Scientific pitch notation (middle C = C4):

  • Octave 0: C0 to B0 (subcontra octave)
  • Octave 4: C4 to B4 (one-line octave, middle C)
  • Octave 8: C8 to B8 (five-line octave)

Alter

Chromatic alteration in semitones:

  • -2: Double flat
  • -1: Flat
  • 0: Natural (can be omitted)
  • +1: Sharp
  • +2: Double sharp

Accidentals

The alter parameter changes the sounding pitch, while the accidental parameter controls visual display:

  • alter: Affects playback (actual pitch)
  • accidental: Visual symbol (sharp, flat, natural, etc.)

Usually both are specified together, but you can have:

  • alter without accidental (implied by key signature)
  • accidental without alter (cautionary accidental)

Usage

Created via Measure#add_pitch or Measure#pitch:

measure.pitch 'C', octave: 5, duration: 4, type: 'quarter'
measure.add_pitch step: 'F', alter: 1, octave: 4, duration: 2, type: 'eighth'

Examples:

Middle C quarter note

PitchedNote.new('C', octave: 4, duration: 4, type: 'quarter')

F# with sharp symbol

PitchedNote.new('F', alter: 1, octave: 5, duration: 2, type: 'eighth',
                accidental: 'sharp')

Bb dotted half note with staccato

PitchedNote.new('B', alter: -1, octave: 4, duration: 6, type: 'half',
                dots: 1, accidental: 'flat', staccato: true)

High A with trill

PitchedNote.new('A', octave: 6, duration: 8, type: 'whole',
                trill_mark: true)

Chord notes (C major triad)

measure.pitch 'C', octave: 4, duration: 4, type: 'quarter'
measure.pitch 'E', octave: 4, duration: 4, type: 'quarter', chord: true
measure.pitch 'G', octave: 4, duration: 4, type: 'quarter', chord: true

Grace note with slur

PitchedNote.new('D', octave: 5, grace: true, type: 'eighth',
                slur: 'start')

See Also:

Instance Method Summary collapse

Constructor Details

#initialize(positional_step = nil, step: nil, alter: nil, octave:, pizzicato: 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) ⇒ PitchedNote

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a pitched note.

For detailed parameter documentation, see Note#initialize

Examples:

C natural in octave 4, quarter note

PitchedNote.new('C', octave: 4, duration: 4, type: 'quarter')

F sharp in octave 5, eighth note

PitchedNote.new('F', alter: 1, octave: 5, duration: 2, type: 'eighth',
                accidental: 'sharp')

B flat with keyword syntax

PitchedNote.new(step: 'B', alter: -1, octave: 4, duration: 4,
                type: 'quarter', accidental: 'flat')

Parameters:

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

    step as positional parameter (alternative to keyword)

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

    diatonic step: 'C', 'D', 'E', 'F', 'G', 'A', 'B'

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

    semitone alteration: -2 (double flat), -1 (flat), 0 (natural), +1 (sharp), +2 (double sharp)

  • octave (Integer)

    octave number (scientific pitch notation, middle C = 4)

  • 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



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/musa-dsl/musicxml/builder/pitched-note.rb', line 101

def initialize(positional_step = nil, step: nil, alter: nil, octave:,
               pizzicato: 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)

  @step = step || positional_step
  @alter = alter
  @octave = octave

  super
end

Instance Method Details

#alter(value) ⇒ Object #alter=(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Alter builder/setter.

Overloads:

  • #alter(value) ⇒ Object

    Sets alteration via DSL

    Parameters:

    • value (Integer)

      semitone alteration (-2 to +2)

  • #alter=(value) ⇒ Object

    Sets alteration via assignment

    Parameters:

    • value (Integer)

      semitone alteration (-2 to +2)



156
# File 'lib/musa-dsl/musicxml/builder/pitched-note.rb', line 156

attr_simple_builder :alter

#octave(value) ⇒ Object #octave=(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Octave builder/setter.

Overloads:

  • #octave(value) ⇒ Object

    Sets octave via DSL

    Parameters:

    • value (Integer)

      octave number

  • #octave=(value) ⇒ Object

    Sets octave via assignment

    Parameters:

    • value (Integer)

      octave number



165
# File 'lib/musa-dsl/musicxml/builder/pitched-note.rb', line 165

attr_simple_builder :octave

#step(value) ⇒ Object #step=(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Step builder/setter.

Overloads:

  • #step(value) ⇒ Object

    Sets step via DSL

    Parameters:

    • value (String)

      diatonic step ('C'-'G')

  • #step=(value) ⇒ Object

    Sets step via assignment

    Parameters:

    • value (String)

      diatonic step ('C'-'G')



147
# File 'lib/musa-dsl/musicxml/builder/pitched-note.rb', line 147

attr_simple_builder :step