Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

better comments

  • Loading branch information...
commit 05f2fb1870549588202f9fc6921f94b12b58fe2b 1 parent f56c23b
@arirusso authored
View
8 examples/input.rb
@@ -5,15 +5,13 @@
require 'unimidi'
-# this program selects the first midi input and sends an inspection of the first 10 messages
+# this program prompts the user to select a midi input and sends an inspection of the first 10 messages
# messages it receives to standard out
num_messages = 10
-# UniMIDI::Device.all.to_s will list your midi devices
-# or amidi -l from the command line
-
-UniMIDI::Input.gets do |input|
+# prompt the user
+UniMIDI::Input.gets do |input| # using their selection...
$>.puts "send some MIDI to your input now..."
View
10 examples/output.rb
@@ -5,23 +5,21 @@
require 'unimidi'
-# this program selects the first midi output and sends some arpeggiated chords to it
+# this program prompts the user to select a midi output and sends some arpeggiated chords to it
notes = [36, 40, 43] # C E G
octaves = 5
duration = 0.1
-# UniMIDI::Device.all.to_s will list your midi devices
-# or amidi -l from the command line
-
-UniMIDI::Output.gets do |output|
+# prompt the user to select an output
+UniMIDI::Output.gets do |output| # using their selection...
(0..((octaves-1)*12)).step(12) do |oct|
notes.each do |note|
output.puts(0x90, note + oct, 100) # note on
- sleep(duration) # wait
+ sleep(duration) # wait
output.puts(0x80, note + oct, 100) # note off
end
View
3  examples/select_a_device.rb
@@ -5,9 +5,10 @@
#
# This is an example that explains how to select an output.
+# It's not really meant to be run.
#
-# The simplest and most useful way to select an output is to prompt the user for selection in
+# The simplest way to select an output is to prompt the user for selection in
# the Ruby console
output = UniMIDI::Output.gets
Please sign in to comment.
Something went wrong with that request. Please try again.