| | |
Play those cute little Wave files (Python)
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
The code is shamefully short, but here it is. Now you can listen to the many sound files in wave (.wav) format and boing, chirp, chime, bark, booh, laugh and mooh at the people around you.
# play a wave sound on a Windows Box # Python23 tested vegaseat 2/8/2005 import winsound import time # pick a wave file supplied by Windows XP or one of your own ... # soundfile = "c:\\Windows\\Media\\chimes.wav" # Python also accepts the forward slash soundfile = "c:/Windows/Media/chimes.wav" winsound.PlaySound(soundfile, winsound.SND_FILENAME|winsound.SND_ASYNC) # wait one and a half seconds time.sleep(1.5) # play the system exit sound if set winsound.PlaySound("SystemExit", winsound.SND_ALIAS)
Similar Threads
- Code Snippet: Play a wave file (C#) (C#)
- Flash drives won't play video files on 8GB & 16GB drives, but will play on 2GB drives (Storage)
- copy all wave files to specified folder- device application (C#)
- Can't play MP3 files (Windows Vista and Windows 7)
- Playing Real Media files, minimizes Wave volume (Windows NT / 2000 / XP)
| Thread Tools | Search this Thread |
alarm ansi assignment avogadro backend beginner binary bluetooth character cmd code copy customdialog cx-freeze data decimals dictionary directory drive dynamic error examples excel exe file float format function gnu graphics gui halp heads homework http ideas import input java leftmouse line linux list lists logging loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext sqlite statistics stdout string strings sudokusolver sum table terminal text thread threading time tkinter tlapse tricks tuple tutorial ubuntu unicode urllib urllib2 variable ventrilo wikipedia windows write wxpython xlib



