Module: CWG::ToneHelpers
- Included in:
- ToneGenerator
- Defined in:
- /Users/martyn/cw/cw_clone/lib/cw/tone_helpers.rb
Constant Summary
- TWO_PI =
2 * Math::PI
- HERE =
File.dirname(__FILE__) + '/../../'
- DOT_FILENAME =
HERE + "audio/dot.wav"
- DASH_FILENAME =
HERE + "audio/dash.wav"
- SPACE_FILENAME =
HERE + "audio/space.wav"
- E_SPACE_FILENAME =
HERE + "audio/e_space.wav"
Instance Method Summary (collapse)
- - (Object) convert_words(wrds)
- - (Object) generate_space(number_of_samples)
- - (Boolean) last_element?(idx, chr)
- - (Boolean) space_sample?(ele)
Instance Method Details
- (Object) convert_words(wrds)
14 15 16 |
# File '/Users/martyn/cw/cw_clone/lib/cw/tone_helpers.rb', line 14 def convert_words wrds wrds.to_array.collect{ |wrd| wrd.delete("\n")} end |
- (Object) generate_space(number_of_samples)
18 19 20 |
# File '/Users/martyn/cw/cw_clone/lib/cw/tone_helpers.rb', line 18 def generate_space number_of_samples [].fill(0.0, 0, number_of_samples) end |
- (Boolean) last_element?(idx, chr)
26 27 28 |
# File '/Users/martyn/cw/cw_clone/lib/cw/tone_helpers.rb', line 26 def last_element? idx, chr idx == chr.size - 1 end |
- (Boolean) space_sample?(ele)
22 23 24 |
# File '/Users/martyn/cw/cw_clone/lib/cw/tone_helpers.rb', line 22 def space_sample? ele ele == :space || ele == :e_space end |