Module: Musa::Neumalang::Neumalang::Parser::ProcessOfVectors 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 process notation (rhythmic process).

Transforms process notation "<< 1 _ _ 2 _ >>" into P structure. P represents rhythmic/temporal processes with values and rests.

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 process structure.

Interleaves durations and rests: [first, duration1, rest1, duration2, rest2, ...]

Returns:

  • (Hash)

    p with kind :p



592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/musa-dsl/neumalang/neumalang.rb', line 592

def value
  durations_rest = []
  i = 0

  rests = captures(:rest).collect(&:value)
  captures(:durations).collect(&:value).each do |duration|
    durations_rest[i * 2] = duration
    durations_rest[i * 2 + 1] = rests[i]
    i += 1
  end

  p = ([ capture(:first).value ] + durations_rest).extend(Musa::Datasets::P)
  { kind: :p, p: p }.extend(Musa::Neumas::Neuma)
end