Want more features on Pastebin? Sign Up, it's FREE!
Guest

We Wish You A Python Christmass

By: a guest on Dec 25th, 2012  |  syntax: Python  |  size: 1.49 KB  |  views: 4,673  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import winsound as sound
  2. n={'C4':261,'C#4':277,'D4':293,'D#4':311,
  3.    'E4':329,'F4':349,'F#4':370,'G4':392,'G#4':415,'A4':440,
  4.    'A#4':466,'B4':494,'C5':523,'C#5':554,'D5':587}
  5. w=1000*2
  6. h=500*2
  7. q=250*2
  8. e=125*2
  9. s=62*2
  10.  
  11. def playnote(note,dur):
  12.    
  13.     sound.Beep(n[note],dur)
  14. while True:
  15.     playnote('C4',q)
  16.  
  17.     playnote('F4',q)
  18.     playnote('F4',e)
  19.     playnote('G4',e)
  20.     playnote('F4',e)
  21.     playnote('E4',e)
  22.  
  23.     playnote('D4',q)
  24.     playnote('D4',q)
  25.     playnote('D4',q)
  26.  
  27.     playnote('G4',q)
  28.     playnote('G4',e)
  29.     playnote('A4',e)
  30.     playnote('G4',e)
  31.     playnote('F4',e)
  32.  
  33.     playnote('E4',q)
  34.     playnote('E4',q)
  35.     playnote('E4',q)
  36.  
  37.     playnote('A4',q)
  38.     playnote('A4',e)
  39.     playnote('A#4',e)
  40.     playnote('A4',e)
  41.     playnote('G4',e)
  42.  
  43.     playnote('F4',q)
  44.     playnote('D4',q)
  45.     playnote('C4',e)
  46.     playnote('C4',e)
  47.  
  48.     playnote('D4',q)
  49.     playnote('G4',q)
  50.     playnote('E4',q)
  51.  
  52.     playnote('F4',w)
  53.     playnote('C4',q)
  54.  
  55.     playnote('F4',q)
  56.     playnote('F4',q)
  57.     playnote('F4',q)
  58.  
  59.     playnote('E4',w)
  60.     playnote('E4',q)
  61.  
  62.     playnote('F4',q)
  63.     playnote('E4',q)
  64.     playnote('D4',q)
  65.  
  66.     playnote('C4',w)
  67.     playnote('G4',q)
  68.  
  69.     playnote('A4',q)
  70.     playnote('G4',e)
  71.     playnote('G4',e)
  72.     playnote('F4',e)
  73.     playnote('F4',e)
  74.  
  75.     playnote('C5',q)
  76.     playnote('C4',q)
  77.     playnote('C4',e)
  78.     playnote('C4',e)
  79.  
  80.     playnote('D4',q)
  81.     playnote('G4',q)
  82.     playnote('E4',q)
  83.  
  84.     playnote('F4',w)
clone this paste RAW Paste Data