how to play sound in 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
from playsound import playsound
playsound('your mp3 file.mp3')
Example 4: 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 5: play sound directly with pytts
import pyttsx
engine = pyttsx.init()
engine.say('Good morning.')
engine.runAndWait()
Example 6: how to play sound in python
import playsound from playsound
playsound("C:\\file_link\\file_name")