[Nvda-dev] NVDA console and speaking text

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Nvda-dev] NVDA console and speaking text

Lubos Pintes-2
Hi Jamie,
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 :-).


Reply | Threaded
Open this post in threaded view
|

Re: [Nvda-dev] NVDA console and speaking text

James Teh-2
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
is. :)

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
straight away.
To work around this, you need to queue the speech request:
import queueHandler
import speech
queueHandler.queueFunction(queueHandler.eventQueue, speech.speakText,
"testing")

Jamie

--
James Teh
Email: [hidden email]
WWW: http://www.jantrid.net/
MSN Messenger: [hidden email]
Jabber: [hidden email]
Yahoo: jcs_teh