Class: Musa::Transcriptors::FromGDV::Base

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

Overview

Base transcriptor for processing .base or .b attributes.

Converts GDV events marked with :base or :b to zero-duration events, useful for representing rests or structural markers.

Processing

  • Checks for :base or :b attribute
  • If found, replaces event with {duration: 0} marked as AbsD
  • If not found, passes through unchanged

Examples:

Process base event

base = Base.new
gdv = { grade: 0, duration: 1r, base: true }
result = base.transcript(gdv, base_duration: 1/4r, tick_duration: 1/96r)
# => { duration: 0 }

Normal event (unchanged)

gdv = { grade: 0, duration: 1r }
result = base.transcript(gdv, base_duration: 1/4r, tick_duration: 1/96r)
# => { grade: 0, duration: 1r }

Instance Method Summary collapse

Instance Method Details

#transcript(gdv, base_duration:, tick_duration:) ⇒ Hash

Transcribes GDV event, converting base markers to zero-duration events.

Parameters:

  • gdv (Hash)

    GDV event with musical attributes

  • base_duration (Rational)

    base duration unit (e.g., quarter note)

  • tick_duration (Rational)

    minimum tick duration (e.g., 1/96)

Returns:

  • (Hash)

    transcribed event (zero-duration if base, unchanged otherwise)



90
91
92
93
94
95
# File 'lib/musa-dsl/transcription/from-gdv.rb', line 90

def transcript(gdv, base_duration:, tick_duration:)
  base = gdv.delete :base
  base ||= gdv.delete :b

  super base ? { duration: 0 }.extend(Musa::Datasets::AbsD) : gdv, base_duration: base_duration, tick_duration: tick_duration
end