class CW::ToneGenerator::Code

Public Class Methods

new(sample_rate, wpm) click to toggle source
# File lib/cw/tone_generator.rb, line 19
def initialize sample_rate, wpm
  @sample_rate = sample_rate
  @wpm = wpm
  @spb_short = @sample_rate * 1.2 / @wpm
  @spb_long = @sample_rate * 3.6 / @wpm
end

Public Instance Methods

filename(element) click to toggle source
# File lib/cw/tone_generator.rb, line 26
def filename element
  self.send "#{element}_path"
end
spb(element) click to toggle source
# File lib/cw/tone_generator.rb, line 30
def spb element
  spb = element == :dash ?
          @spb_long    :
          @spb_short
  spb.to_i
end