Sha256: cc60bc92b3ef10b4d507b7dee0aa1b344e8ec4185de6740ab0d2b828ecbe05e1

Contents?: true

Size: 506 Bytes

Versions: 6

Compression:

Stored size: 506 Bytes

Contents

module Music
module Transcription
module Parsing
  class PitchNode < Treetop::Runtime::SyntaxNode
    def to_pitch
      
      sem = pitch_letter.to_semitone
      unless mod.empty?
        sem += case mod.text_value
        when "#" then 1
        when "b" then -1
        end
      end
      oct = octave.to_i
      ncents = 0
      unless cents.empty?
        ncents = cents.to_i
      end
      
      Music::Transcription::Pitch.new(semitone: sem, octave: oct, cent: ncents)
    end
  end
end
end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
music-transcription-0.21.0 lib/music-transcription/parsing/pitch_node.rb
music-transcription-0.20.0 lib/music-transcription/parsing/pitch_node.rb
music-transcription-0.19.0 lib/music-transcription/parsing/pitch_node.rb
music-transcription-0.17.1 lib/music-transcription/parsing/pitch_node.rb
music-transcription-0.17.0 lib/music-transcription/parsing/pitch_node.rb
music-transcription-0.16.0 lib/music-transcription/parsing/pitch_node.rb