Module: Hammelin
- Extended by:
- Hammelin
- Included in:
- Hammelin
- Defined in:
- lib/hammelin.rb,
lib/hammelin/note.rb,
lib/hammelin/version.rb,
lib/hammelin/notes_range.rb
Defined Under Namespace
Classes: Note, NotesRange
Constant Summary
collapse
- PADDING =
" "
- VERSION =
"0.0.5"
Instance Method Summary
collapse
Instance Method Details
#compose(filename = nil, &block) ⇒ Object
37
38
39
40
41
42
|
# File 'lib/hammelin.rb', line 37
def compose(filename=nil,&block)
instance_eval &block
save_to_file(filename) if filename
ensure
player.close
end
|
#play(tune) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/hammelin.rb', line 20
def play(tune)
tune.play
rescue NoMethodError
case tune
when String
Note.new(tune).play
when Array
NotesRange.from_array(tune).play
end
end
|
#play_string(tune) ⇒ Object
31
32
33
34
35
|
# File 'lib/hammelin.rb', line 31
def play_string(tune)
player.play(tune)
add_to_log(tune)
player.close
end
|