python播放wav音頻文件代碼
# play a wave sound on a Windows BoxPython23 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)</pre>
本文由用戶 mxw8 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!