Your projects may require python play audio for you based on some events in the program,Pygame comes to the rescue.Although Pygame can do much more we will restrict ourselves to just playing audio here,apart from that pygame is the only module which I found do the job for me.
Download pygame from here for your OS of choice(select correct version of python).
The time.wait() is here used for controlling the duration for which audio is played,and it takes the duration as argument in milliseconds(ms).
Pygame library can handle most of the famous audio formats mp3,wav,ogg etc...
That's it for now:) Comment if want more.
Download pygame from here for your OS of choice(select correct version of python).
download as text play_audio.py.txt |
Pygame library can handle most of the famous audio formats mp3,wav,ogg etc...
That's it for now:) Comment if want more.
No comments:
Post a Comment