Just for fun I wanted to play with NVDA console. To speak text I wrote:
>>> import speech
>>> speech.speakText("NVDA console is funny!", wait=True)
But nothing was said. Where is problem?
Tones for example beeped nicely :-).
Lubos Pintes wrote:
> Just for fun I wanted to play with NVDA console. To speak text I wrote:
> >>> import speech
> >>> speech.speakText("NVDA console is funny!", wait=True)
> But nothing was said. Where is problem?
Hmm. When I first read your message, I didn't read the "wait=True".
wait=True is quite nasty and with eSpeak on my system, it causes a
freeze unless it is after speech init. I can't quite work out why this
As for why it doesn't work with wait=False, this is actually quite an
interesting issue that caused me some problems when developing the thing. :)
It is not actually a bug - or at least, not one that can be solved
without nasty hacks.
To describe the problem, this is what happens:
1. You enter a command to produce speech (such as the one above).
2. You press enter.
3. Because this is a key press, NVDA queues a request to stop speech.
4. The command is executed by the Python console. The text is spoken.
5. Unfortunately, when NVDA next processes the event queue, the request
to stop speech (step 3) gets executed.
So, your speech is actually happening, but it is getting silenced
To work around this, you need to queue the speech request: