python how to play sounds code example
Example 1: Play sound in python
import winsound
winsound.PlaySound('sound.wav', winsound.SND_FILENAME)
Example 2: python 3 play sound
from playsound import playsound
wavFile = input("Enter a wav filename: ")
playsound(wavFile)
mp3File = input("Enter a mp3 filename: ")
playsound(mp3File)
Example 3: play sound directly with pytts
import pyttsx
engine = pyttsx.init()
engine.say('Good morning.')
engine.runAndWait()
Example 4: how to play sound in python
import playsound from playsound
playsound("C:\\file_link\\file_name")
Example 5: play sound sing os module
from playsound import playsoundplaysound('audio.mp3')