Skip to content

Instantly share code, notes, and snippets.

@alexmoore
Created Aug 31, 2012
Embed
What would you like to do?
[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