Play audio with Python

Play audio with Python

Your best bet is probably to use pygame/SDL. Its an external library, but it has great support across platforms.


You can find more specific documentation about the audio mixer support in the documentation

Try playsound which is a Pure Python, cross platform, single function module with no dependencies for playing sounds.

Install via pip:

$ pip install playsound

Once youve installed, you can use it like this:

from playsound import playsound

Play audio with Python

Take a look at Simpleaudio, which is a relatively recent and lightweight library for this purpose:

> pip install simpleaudio


import simpleaudio as sa

wave_obj = sa.WaveObject.from_wave_file(path/to/file.wav)
play_obj =

Make sure to use uncompressed 16 bit PCM files.

Leave a Reply

Your email address will not be published. Required fields are marked *