Skip to content

Instantly share code, notes, and snippets.

@alexmoore
Created August 31, 2012 21:46
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 alexmoore/3559587 to your computer and use it in GitHub Desktop.
Save alexmoore/3559587 to your computer and use it in GitHub Desktop.
[hg]|[git] push -m 'it real good'
require 'Win32API'
Beep = Win32API.new('kernel32', 'Beep', ['I', 'I'], 'I')
def Rest(ms)
sleep(ms / 1000.0)
end
c = 1046
d = 1175
e = 1319
f = 1397
g = 1568
a = 1760
bpm = 130
# assuming 4/4 time
quarter = 60.0 / bpm * 1000
eighth = quarter / 2
Beep.call(d,quarter)
Beep.call(a,eighth)
Beep.call(g,eighth)
Rest(eighth)
Beep.call(f,eighth)
Rest(eighth)
Beep.call(e,eighth)
Rest(eighth)
Beep.call(c,eighth)
Rest(eighth)
Beep.call(c,eighth)
Beep.call(e,eighth)
Beep.call(f,eighth)
Beep.call(e,eighth)
Beep.call(c,eighth)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment