Class: RubySketch::MML
- Inherits:
-
Object
- Object
- RubySketch::MML
- Defined in:
- lib/rubysketch/mml.rb
Overview
MML (Music Macro Language) compiler.
Constant Summary collapse
- TONES =
Oscillator tone types selectable with the ‘@N` command.
%i[ sine triangle square sawtooth pulse12_5 pulse25 noise ].freeze
Class Method Summary collapse
-
.compile(str, streaming = false) ⇒ Sound
Compile MML string into a sound.
-
.play(str) ⇒ nil
Compile and play MML string.
Class Method Details
.compile(str, streaming = false) ⇒ Sound
Compile MML string into a sound.
23 24 25 26 |
# File 'lib/rubysketch/mml.rb', line 23 def compile(str, streaming = false) seq, duration = compile__! str Sound.new Beeps::Sound.new(seq, streaming ? 0 : duration) end |
.play(str) ⇒ nil
Compile and play MML string.
108 109 110 |
# File 'lib/rubysketch/mml.rb', line 108 def play(str) compile(str).play end |