Skip to content

Instantly share code, notes, and snippets.

@xaviershay
Forked from urug/fizzbuzz_midi.rb
Created December 17, 2008 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xaviershay/37129 to your computer and use it in GitHub Desktop.
Save xaviershay/37129 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'midiator'
# Upped the tempo, reveals new curiosities
midi = MIDIator::Interface.new
midi.use("dls_synth")
#midi.autodetect_driver
midi.control_change 32, 10, 1
midi.program_change 10, 26
include MIDIator::Drums
(1..1000).each do |i|
note, val = if i%15 == 0
[CrashCymbal1, "FizzBuzz"]
elsif i%5 == 0
[SnareDrum1, "Buzz"]
elsif i%3 == 0
[LowTom1, "Fizz"]
else
[BassDrum1, i]
end
puts val
midi.play note, 0.08, 10
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment