Class: Brevity::PolyphonicNoteNode

Inherits:
NoteNode
  • Object
show all
Defined in:
lib/brevity/parsing/note/note_nodes.rb

Instance Method Summary collapse

Methods inherited from NoteNode

#itemize, #primitives

Instance Method Details

#to_noteObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/brevity/parsing/note/note_nodes.rb', line 55

def to_note
  pitches = [ pl.pitch.to_pitch ]
  links = {}
  unless pl.the_link.empty?
    links[pitches[0]] = pl.the_link.to_link
  end
  
  more_pitches.elements.each do |mp|
    pitches.push mp.pl.pitch.to_pitch
    unless mp.pl.the_link.empty?
      links[pitches[-1]] = mp.pl.the_link.to_link
    end
  end
  
  if acc.empty?
    Music::Transcription::Note.new(duration.to_r,pitches,links:links)
  else
    accent = acc.text_value.to_accent
    Music::Transcription::Note.new(duration.to_r,pitches,links:links,accent:accent)
  end
end