Skip to content

Instantly share code, notes, and snippets.

@p3trus
Last active August 29, 2015 13:56
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 p3trus/8979942 to your computer and use it in GitHub Desktop.
Save p3trus/8979942 to your computer and use it in GitHub Desktop.
beeping melodies :)
from winsound import Beep
import time
nationalhymne = [
(704, 750),
(792, 250),
(880, 500),
(792, 500),
(940, 500),
(880, 500),
(792, 250),
(660, 250),
(704, 500),
(1188, 500),
(1056, 500),
(940, 500),
(880, 500),
(792, 500),
(880, 250),
(704, 250),
(1056, 1000),
(704, 750),
(792, 250),
(880, 500),
(792, 500),
(940, 500),
(880, 500),
(792, 250),
(660, 250),
(704, 500),
(1188, 500),
(1056, 500),
(940, 500),
(880, 500),
(792, 500),
(880, 250),
(704, 250),
(1056, 1000),
(792, 500),
(880, 500),
(792, 250),
(660, 250),
(528, 500),
(940, 500),
(880, 500),
(792, 250),
(660, 250),
(528, 500),
(1056, 500),
(940, 500),
(880, 750),
(880, 250),
(990, 500),
(940, 250),
(1056, 250),
(1056, 1000),
(1408, 750),
(1320, 250),
(1320, 250),
(1188, 250),
(1056, 500),
(1188, 750),
(1056, 250),
(1056, 250),
(940, 250),
(880, 500),
(792, 750),
(880, 125),
(940, 125),
(1056, 250),
(1188, 250),
(940, 250),
(792, 250),
(704, 500),
(880, 250),
(792, 250),
(704, 1000),
(1408, 750),
(1320, 250),
(1320, 250),
(1188, 250),
(1056, 500),
(1188, 750),
(1056, 250),
(1056, 250),
(940, 250),
(880, 500),
(792, 750),
(880, 125),
(940, 125),
(1056, 250),
(1188, 250),
(940, 250),
(792, 250),
(704, 500),
(880, 250),
(792, 250),
(704, 1000),
]
tetris = [
(1320, 500),
(990, 250),
(1056, 250),
(1188, 250),
(1320, 125),
(1188, 125),
(1056, 250),
(990, 250),
(880, 500),
(880, 250),
(1056, 250),
(1320, 500),
(1188, 250),
(1056, 250),
(990, 750),
(1056, 250),
(1188, 500),
(1320, 500),
(1056, 500),
(880, 500),
(880, 500),
(None, 250),
(1188, 500),
(1408, 250),
(1760, 500),
(1584, 250),
(1408, 250),
(1320, 750),
(1056, 250),
(1320, 500),
(1188, 250),
(1056, 250),
(990, 500),
(990, 250),
(1056, 250),
(1188, 500),
(1320, 500),
(1056, 500),
(880, 500),
(880, 500),
(None, 500),
(1320, 500),
(990, 250),
(1056, 250),
(1188, 250),
(1320, 125),
(1188, 125),
(1056, 250),
(990, 250),
(880, 500),
(880, 250),
(1056, 250),
(1320, 500),
(1188, 250),
(1056, 250),
(990, 750),
(1056, 250),
(1188, 500),
(1320, 500),
(1056, 500),
(880, 500),
(880, 500),
(None, 250),
(1188, 500),
(1408, 250),
(1760, 500),
(1584, 250),
(1408, 250),
(1320, 750),
(1056, 250),
(1320, 500),
(1188, 250),
(1056, 250),
(990, 500),
(990, 250),
(1056, 250),
(1188, 500),
(1320, 500),
(1056, 500),
(880, 500),
(880, 500),
(None, 500),
(660, 1000),
(528, 1000),
(594, 1000),
(495, 1000),
(528, 1000),
(440, 1000),
(419, 1000),
(495, 1000),
(660, 1000),
(528, 1000),
(594, 1000),
(495, 1000),
(528, 500),
(660, 500),
(880, 1000),
(838, 2000),
(660, 1000),
(528, 1000),
(594, 1000),
(495, 1000),
(528, 1000),
(440, 1000),
(419, 1000),
(495, 1000),
(660, 1000),
(528, 1000),
(594, 1000),
(495, 1000),
(528, 500),
(660, 500),
(880, 1000),
(838, 2000),
]
def play(melody):
for f, t in melody:
if not f:
time.sleep(t/1000.)
else:
Beep(f, t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment