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

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)



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

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



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

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')



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

attr_simple_builder :step