python播放wav音频文件代码,python播放wav音频,# play a wav


# 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)

评论关闭