How to play audio from text withou saving it with gtts and Python

Поділитися
Вставка
  • Опубліковано 16 вер 2024

КОМЕНТАРІ • 14

  • @ghostofdune3152
    @ghostofdune3152 2 роки тому +2

    Great video , thank you
    btw i had a problem that imo it's worth to mention here. If i don't put time.sleep(5) to program it's not speak and directly shot it self.

    • @johnstarfire
      @johnstarfire  2 роки тому +1

      It could be a connection problemi, try to split long sentences into more short once said One After another putting them into a list. You Can split the phrase and then iterate the list of parts so that It takes less time to create the audio

    • @GoeieWoofer
      @GoeieWoofer Рік тому

      @@johnstarfire Im having the same problem , have to put time.sleep(5) at the end of the main code or else the sound simply just wont play

    • @johnstarfire
      @johnstarfire  Рік тому

      @@GoeieWoofer I get the same problem too, before I did not have it (I do not know if it is because I am using a different computer or because of a new version of python). I had to add some sleep time too, I got to investigate on the possible cause. I will check if it happens with python 3.11 that I just installed. I'll let you know, maybe in a next video

    • @johnstarfire
      @johnstarfire  Рік тому

      Ok, in python 3.11 it does not work yet, maybe because pygame is not yet ready for 3.11, it gave me error (mp3 corrupted), I am using pygame 2.1.3.dev8 version of pygame with pip install pygame==2.1.3.dev8

  • @BharatPrajapati2503
    @BharatPrajapati2503 2 роки тому

    ❤️❤️❤️

  • @adityatiwari3646
    @adityatiwari3646 6 днів тому

    Comeon didnt worked man

    • @johnstarfire
      @johnstarfire  6 днів тому

      I will make a new video today, look in the info for the link in a couple of hours, I will do it again with some new stuffs

  • @ordell3917
    @ordell3917 Рік тому +1

    lol? The fuck is going on

    • @johnstarfire
      @johnstarfire  Рік тому

      What?

    • @birdbot5897
      @birdbot5897 Рік тому +1

      lol, he is like yooo this dude is like it doesnt work but yeah at least you watched till the end

    • @johnstarfire
      @johnstarfire  Рік тому

      @@birdbot5897 it works, but with the last version of python there is a problem. You have to put a pause at the end. Put import time at the beginning and then put time.sleep(5) at the end and you will hear it. Another problem is that with the last version of python (3.11) the pygame module is not yet ready. If you use a previous version of python it will work. Soon I will make an update of this. Have fun. (in the info of the video there is the code with the pause). You can also check it online here replit.com/@EducationalChan/speak#main.py