Http://blog.csdn.net/jj_liuxin/archive/2008/12/21/3574638.aspx
Just take a look at the python 3.0 documentation and find a very pythonic module: sound playback for windows; a buzzword called "silly and naive", which is quite easy.
1> winsound. BEEP
2> winsound. playsound ()
Each one has a different usage. Let's look at it one by one.
1> winsound. Beep (frequency, duration)
The PC speaker just gave it a drop. The first parameter, frequency, indicates the number of decibels. The value ranges from 37 to 32767. The second parameter is duration, in milliseconds (if you are patient, try winsound. Beep (32767,99999), ).
2> winsound. playsound
- Import
Winsound
- # Play windows exit sound.
- Winsound. playsound (
"Systemexit"
, Winsound. snd_alias)
- # Probably play Windows Default sound, if any is registered (because
- # "*" Probably isn' t the registered name of any sound ).
- Winsound. PlaySound (
"*"
, Winsound. SND_ALIAS)
However, only wav files can be played, and WMA and MP3 files cannot be played. These two types also require support from other packages.