Play sound : which package works in Python?

Question:
Hello,

I’m using gtts to make text to speech with Google.
The result is a .mp3 file that I can click on and play in the files list of Repl.it

But is there a way to add a package to be able to generate it and immediately play it ?
I have tried many packages but they all fail. Is there a way to do it ?

Thanks

Check this topic : How to add audio to replit - #10 by dragonhunter1

Thanks for your answer,
so the real solution, for those who don’t want to read the other post and fork the example, is to use the replit package (even if it is not perfect)
Be careful that you have to put an infinite loop somewhere after the play because it doesn’t have an option to block during the play of the file

from replit import audio as a
import time
player=a.play_file(“Song.mp3”,0.5)
#0.5 specifies the volume
time.sleep(1)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.