Sometimes, we want to play a wav file in Python.
In this article, we’ll look at how to play a wav file in Python.
How to play a wav file in Python?
To play a wav file in Python, we can use the playsound
library.
To install it, we run
pip install playsound
Then we use it by writing
from playsound import playsound
playsound('/path/to/a/sound/file/you/want/to/play.wav')
to call playsound
with the path of the wav file to play it.
Conclusion
To play a wav file in Python, we can use the playsound
library.