Sha256: b3f1eba87da5c27c90b49b0234ecb750b545f6bac7df36e2c0b731e59016c1d4
Contents?: true
Size: 525 Bytes
Versions: 11
Compression:
Stored size: 525 Bytes
Contents
class Numeric #:doc: # # +semitopch+: semitone to pitch class converter # # interprets its receiver as a semitone quantity (starting from 0 at # pitch class 0.00) and returns its corresponing pitch class # #:nodoc: def semitopch oct = (self / CNPO).mround(8).to_i # rounding corrects modulo aberrations semi = (self - (oct * CNPO)).mround(8) # rounding corrects modulo aberrations semi %= CNPO semi = (self >= 0.0) ? semi : -((CNPO - semi) % CNPO) oct + (semi / PCC) end end
Version data entries
11 entries across 11 versions & 1 rubygems