Search code examples
pythonaccessibilitytext-to-speechsapi

how to lengthen the pause between the words with text-to-speech (pyTTS or SAPI5)


Is it possible to extend the gap between spoken words when using text to speech with SAPI5 ?

The problem is that esp. with some voices, the words are almost connected to each other, which makes the speech more difficult to understand.

I'm using python and pyTTS module (on windows, since it's using SAPI)

I tried to hook to the OnWord event and add a time.sleep() or tts.Pause(), but apparently even though all the events are caught, they are being processed only at the end of the spoken text, whether i'm using the sync or async flag.

In this NON WORKING example, the sleep() method is executed only after the sentence is spoken:

tts = pyTTS.Create()
def f(x):
    tts.Pause()
    sleep(0.5)
    tts.Resume()

tts.OnWord = f
tts.Speak(text)

Edit: -- accepted solutions

The actual answers for me were either

  • saying each word in its own "speak" command, (suggested by @Lennart Regebro), or
  • replacing each space with a comma, (as mentioned by @Dawson), e.g.

    text = text.replace(" ", ",")

that sets a reasonable pause. I didn't investigate the Pause method more then i mentioned above, since' i'm happy with the accepted solutions.


Solution

  • Your talking about voice Rate, right? http://msdn.microsoft.com/en-us/library/ms990078.aspx

    Pause() I believe, works a lot like a comma in a normal speech pattern...except you determine the length (natural or not).