Class: Musa::Transcriptors::FromGDV::ToMusicXML::Appogiatura

Inherits:
Musa::Transcription::FeatureTranscriptor show all
Defined in:
lib/musa-dsl/transcription/from-gdv-to-musicxml.rb

Overview

Appogiatura transcriptor for MusicXML notation.

Processes appogiatura ornaments, marking them as grace notes for MusicXML output rather than expanding to explicit note sequences. The grace note relationship is preserved through :grace, :graced, and :graced_by attributes.

Appogiatura Format

Input GDV with :appogiatura key:

{
  grade: 0,
  duration: 1r,
  appogiatura: { grade: -1, duration: 1/8r }
}

Output (array of two events):

[
  { grade: -1, duration: 1/8r, grace: true },           # Grace note
  { grade: 0, duration: 1r, graced: true, graced_by: ... } # Main note
]

MusicXML Representation

The :grace attribute indicates the note should be rendered as a grace note in the score. The :graced_by reference allows the notation engine to properly link the grace note to its principal note.

Process: appogiatura (neuma)neuma

Examples:

Process appogiatura

app = Appogiatura.new
gdv = {
  grade: 0,
  duration: 1r,
  appogiatura: { grade: -1, duration: 1/8r }
}
result = app.transcript(gdv, base_duration: 1/4r, tick_duration: 1/96r)
# => [grace_note, main_note]

Instance Method Summary collapse

Instance Method Details

#transcript(gdv, base_duration:, tick_duration:) ⇒ Array<Hash>, Hash

Transcribes GDV appogiatura to grace note representation.

Parameters:

  • gdv (Hash)

    GDV event possibly containing :appogiatura

  • base_duration (Rational)

    base duration unit

  • tick_duration (Rational)

    minimum tick duration

Returns:

  • (Array<Hash>, Hash)

    array with grace note and main note, or unchanged event if no appogiatura



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/musa-dsl/transcription/from-gdv-to-musicxml.rb', line 131

def transcript(gdv, base_duration:, tick_duration:)
  if gdv_appogiatura = gdv[:appogiatura]
    gdv.delete :appogiatura

    # TODO process with Decorators the gdv_appogiatura
    # TODO implement also posterior appogiatura neuma(neuma)
    # TODO implement also multiple appogiatura with several notes (neuma ... neuma)neuma or neuma(neuma ... neuma)

    gdv_appogiatura[:grace] = true
    gdv[:graced] = true
    gdv[:graced_by] = gdv_appogiatura

    [ gdv_appogiatura, gdv ]
  else
    gdv
  end
end