Python Play WAV File: A Beginner Guide – Python Tutorial

By | April 13, 2020

Python can play .wav file, there are some methods can do it. In this tutorial, we will introduce these methods for python beginners.

Method 1: Call other .exe application to play .wav file

We can use python to call other .exe application to play .wav file. Here is an example:

import os
os.popen('F:\\Programs\\xfplay\\xfplay.exe Alarm06.wav')

If the path of .exe contains white spaces, you can read tutorial below to fix it.

Best Practice to Execute an EXE via os.popen() with White Spaces in the Path – Python Tutorial

Method 2: Use python application to play wav file

We can use pyqt5 to play a .wav file. Here is a tutorial.

Python PyQT5 Play WAV File: A Completed Guide – PyQT Tutorial

Leave a Reply