Class: Musa::Transcriptors::FromGDV::ToMIDI::Mordent
- Inherits:
-
Musa::Transcription::FeatureTranscriptor
- Object
- Musa::Transcription::FeatureTranscriptor
- Musa::Transcriptors::FromGDV::ToMIDI::Mordent
- Defined in:
- lib/musa-dsl/transcription/from-gdv-to-midi.rb
Overview
Process: .mor
Instance Method Summary collapse
-
#initialize(duration_factor: nil) ⇒ Mordent
constructor
A new instance of Mordent.
- #transcript(gdv, base_duration:, tick_duration:) ⇒ Object
Methods inherited from Musa::Transcription::FeatureTranscriptor
Constructor Details
#initialize(duration_factor: nil) ⇒ Mordent
Returns a new instance of Mordent.
36 37 38 |
# File 'lib/musa-dsl/transcription/from-gdv-to-midi.rb', line 36 def initialize(duration_factor: nil) @duration_factor = duration_factor || 1/4r end |
Instance Method Details
#transcript(gdv, base_duration:, tick_duration:) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/musa-dsl/transcription/from-gdv-to-midi.rb', line 40 def transcript(gdv, base_duration:, tick_duration:) mor = gdv.delete :mor if mor direction = :up check(mor) do |mor| case mor when true, :up direction = :up when :down, :low direction = :down end end short_duration = [base_duration * @duration_factor, tick_duration].max gdvs = [] gdvs << gdv.clone.tap { |gdv| gdv[:duration] = short_duration } case direction when :up gdvs << gdv.clone.tap { |gdv| gdv[:grade] += 1; gdv[:duration] = short_duration } when :down gdvs << gdv.clone.tap { |gdv| gdv[:grade] -= 1; gdv[:duration] = short_duration } end gdvs << gdv.clone.tap { |gdv| gdv[:duration] -= 2 * short_duration } super gdvs, base_duration: base_duration, tick_duration: tick_duration else super end end |