Module: Musa::Neumalang::Neumalang::Parser::DeltaGradeAttribute Private

Defined in:
lib/musa-dsl/neumalang/neumalang.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Semantic action for differential grade (pitch) attribute.

Parses relative pitch changes: "+2", "-1", "+2#" (with sharp), "+I" (interval). Used for scale-degree-based melodic motion.

Instance Method Summary collapse

Instance Method Details

#valueHash

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.

Builds delta grade structure.

Returns:

  • (Hash)

    delta_grade, delta_sharps, delta_interval attributes



603
604
605
606
607
608
609
610
611
612
613
614
615
616
# File 'lib/musa-dsl/neumalang/neumalang.rb', line 603

def value

  value = {}

  sign = capture(:sign)&.value || 1

  value[:delta_grade] = capture(:grade).value * sign if capture(:grade)
  value[:delta_sharps] = capture(:accidentals).value * sign if capture(:accidentals)

  value[:delta_interval] = capture(:interval).value if capture(:interval)
  value[:delta_interval_sign] = sign if capture(:interval) && capture(:sign)

  value
end