play audio file python code example
Example 1: play music from python
from playsound import playsound
playsound('audio.mp3')
Example 2: Play sound in python
import winsound
winsound.PlaySound('sound.wav', winsound.SND_FILENAME)
Example 3: python3 play a mp3
#pip install playsound
from playsound import playsound
playsound('your mp3 file.mp3')
Example 4: play sound directly with pytts
import pyttsx
engine = pyttsx.init()
engine.say('Good morning.')
engine.runAndWait()