Class: Musa::Transcriptors::FromGDV::ToMIDI::Appogiatura

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

Overview

Appogiatura transcriptor for MIDI playback.

Expands appogiatura ornaments into two sequential notes for MIDI playback. The grace note (appogiatura) is played first, followed by the main note with reduced duration.

Processing

Given an appogiatura marking:

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

Expands to two notes:

[
  { grade: -1, duration: 1/8r },      # Grace note
  { grade: 0, duration: 7/8r }        # Main note (reduced)
]

The main note's duration is reduced by the appogiatura duration to maintain total duration.

Process: appogiatura (neuma)neuma

Examples:

Appogiatura expansion

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)
# => [
#   { grade: -1, duration: 1/8r },
#   { grade: 0, duration: 7/8r }
# ]

Instance Method Summary collapse

Instance Method Details

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

Transcribes appogiatura to two-note sequence.



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/musa-dsl/transcription/from-gdv-to-midi.rb', line 158

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

  if gdv_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[:duration] = gdv[:duration] - gdv_appogiatura[:duration]

    super [ gdv_appogiatura, gdv ], base_duration: base_duration, tick_duration: tick_duration
  else
    super
  end
end