Text-to-speech (TTS) module that works under Python 3

前端 未结 4 1851
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 23:31

I have tried PyTTS (deprecated) and PyTTSx (the most recommended) and two Google TTS solutions (gTTS and another one by some guy named Hung Truong) but none of them worked under

4条回答
  •  情话喂你
    2021-02-09 00:15

    The best solution for that is :

    pyttsx3


    Pyttsx3 is an offline cross-platform Text-to-Speech library which is compatible with both Python 3 and Python 2 and supports multiple TTS engines.

    I have found it very useful and there is no delay in sound production unlike gTTS which needs internet connection to work and also has some delay.

    To install :

    Here is a sample code :

    
        import pyttsx3
        engine = pyttsx3.init()
        engine.say("Hello this is me talking")
        engine.setProperty('rate',120)  #120 words per minute
        engine.setProperty('volume',0.9) 
        engine.runAndWait()
        
    
    

提交回复
热议问题