1

I am trying to play sound in Python. When I run my code, it finishes successfully but the audio is not played by my computer.

I have tried with all the libraries like playsound, simpleaudio, pydub and kivy core audio.

Sample code I tried is:

from playsound import playsound

playsound('myfile.wav')
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Mohan Raj
  • 167
  • 12

2 Answers2

1

As i think it should work, check either your audio file (maybe it's empty) or check your audio drivers and audio output.

OR, You can try

pip install playsound one more time

0

I've had this problem before, use the complete path:

from playsound import playsound
playsound(r"C:\some\path\sound.mp3") # the "r" is necessary, or else your code wont work!
jort57
  • 76
  • 1
  • 10