class Music::Transcription::Parsing::NoteNode

Public Instance Methods

primitives(env) click to toggle source
# File lib/music-transcription/parsing/note_node.rb, line 5
def primitives env
  [ self.to_note ]
end
to_note() click to toggle source
# File lib/music-transcription/parsing/note_node.rb, line 9
def to_note
  pitches = []
  links = {}
  
  unless pitch_links.empty?
    first = pitch_links.first
    more = pitch_links.more
    
    pitches.push first.pitch.to_pitch
    unless first.the_link.empty?
      links[pitches[-1]] = first.the_link.to_link
    end
    
    more.elements.each do |x|
      pitches.push x.pl.pitch.to_pitch
      unless x.pl.the_link.empty?
        links[pitches[-1]] = x.pl.the_link.to_link
      end
    end
  end
  
  artic = Music::Transcription::Articulations::NORMAL
  unless art.empty?
    artic = art.to_articulation
  end
  
  accent_flag = acc.empty? ? false : true
  Music::Transcription::Note.new(duration.to_r,
    pitches, links: links, articulation: artic, accented: accent_flag)
end