0

I know that if I do:

playsound("filepath.mp3", block=False)

that it is supposed to run asynchronously.

But when I try it, the mp3 file doesn't play, when I set it to True (default), the mp3 file plays - but the program halts for the mp3 file to finish playing.

Also trying to run playsound on a different thread just results in an Error:

TypeError: 'module' object is not callable
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Ledrake
  • 114
  • 10
  • 1
    Does this answer your question? [Play sound asynchronously in Python](https://stackoverflow.com/questions/59042397/play-sound-asynchronously-in-python) – abhigyanj Nov 16 '20 at 12:54
  • Does this answer your question? [How do play audio (playsound) in background of Python script?](https://stackoverflow.com/questions/44472162/how-do-play-audio-playsound-in-background-of-python-script) – Shiverz Nov 16 '20 at 12:55

3 Answers3

1

I know that this is very late response but just do this:

playsound("filepath.mp3" , 0)
Kiticana X
  • 11
  • 1
1

With execstring in maXbox:

eng.Execstring('from playsound import playsound')
eng.Execstring('playsound(r"C:\Program Files\Streaming\maxbox4\maxbox4\airmaxloop3.mp3",0)')
  
bdkopen
  • 494
  • 1
  • 6
  • 16
0

Did you import playsound like this

import playsound

or

from playsound import playsound

Because i found that unless you import it from playsound it does not work

Luke
  • 33
  • 4
  • Yep, neither of them work, if i do True the sound is played but the program halts if i do False the sound is not played. Also it doesnt matter how i import it , if i do `import playsound` then i do `playsound.playsound("file.mp3", False)` for `from playsound import playsound` it is just `playsound("file.mp3",False)`. But still the problem persists – Ledrake Nov 21 '20 at 01:07