CloseEncounters

I stumbled across the Python winsound module today. It is a standard library on Windows machines and it has a function for controlling the PC speaker. Harf.

Hear it play the music from Close Encounters of a Third Kind from a list of frequencies and durations:


import winsound

from winsound import *
music=((784,1),(880,1),(698,1),(349,1),(523,3))
for x in music:
Beep(x[0],550*x[1])




A list of frequencies and durations is a simple, computational form of musical notation.