Module: Musa::Neumas::Neuma

Included in:
Parallel, Serie
Defined in:
lib/musa-dsl/neumas/neumas.rb

Overview

Base neuma module for serie and parallel structures.

Mixed into neuma hashes to provide structure-specific methods. Neumas are extended with either Neuma::Serie or Neuma::Parallel.

Defined Under Namespace

Modules: Parallel, Serie

Instance Method Summary collapse

Instance Method Details

#|(other) ⇒ Parallel

Creates parallel structure with another neuma.

Combines this neuma with another into parallel (polyphonic) structure. If already parallel, adds to existing parallel array.

Examples:

Create parallel from neumas

melody = "0 +2 +4".to_neumas
bass = "-7 -5 -3".to_neumas
harmony = melody | bass

Chain multiple parallels

satb = soprano | alto | tenor | bass

Parameters:

Returns:

  • (Parallel)

    parallel neuma structure

Raises:

  • (ArgumentError)

    if other cannot be converted



74
75
76
77
78
79
80
81
82
# File 'lib/musa-dsl/neumas/neumas.rb', line 74

def |(other)
  if is_a?(Parallel)
    clone.tap { |_| _[:parallel] << convert_to_parallel_element(other) }.extend(Parallel)
  else
    { kind: :parallel,
      parallel: [clone, convert_to_parallel_element(other)]
    }.extend(Parallel)
  end
end