Play wave file in python

来源:互联网 发布:淘宝如何快速提升信誉 编辑:程序博客网 时间:2024/06/15 04:46
# play a wave sound on a Windows Box# Python23 tested   vegaseat   2/8/2005import winsoundimport 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 slashsoundfile = "c:/Windows/Media/chimes.wav"winsound.PlaySound(soundfile, winsound.SND_FILENAME|winsound.SND_ASYNC)# wait one and a half secondstime.sleep(1.5)# play the system exit sound if setwinsound.PlaySound("SystemExit", winsound.SND_ALIAS)
原创粉丝点击