class Miserable

Convert BPM (beats-per-minute) to millisecond

Attributes

quarter_note[R]

Public Class Methods

new(bpm) click to toggle source
# File lib/miserable.rb, line 9
def initialize(bpm)
  @quarter_note = (((60 / bpm.to_f) * 1000) * 100_000) / 100_000
end

Public Instance Methods

eighth_note() click to toggle source
# File lib/miserable.rb, line 21
def eighth_note
  @quarter_note / 2
end
half_note() click to toggle source
# File lib/miserable.rb, line 17
def half_note
  @quarter_note * 2
end
sixteenth_note() click to toggle source
# File lib/miserable.rb, line 25
def sixteenth_note
  @quarter_note / 4
end
sixth_note() click to toggle source
# File lib/miserable.rb, line 37
def sixth_note
  whole_note / 6
end
sixtyfourth_note() click to toggle source
# File lib/miserable.rb, line 33
def sixtyfourth_note
  @quarter_note / 16
end
thirtysecond_note() click to toggle source
# File lib/miserable.rb, line 29
def thirtysecond_note
  @quarter_note / 8
end
whole_note() click to toggle source
# File lib/miserable.rb, line 13
def whole_note
  @quarter_note * 4
end