After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 349394 - Speech Dispatcher Backend
Speech Dispatcher Backend
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: speech
0.2.x
Other All
: Normal enhancement
: 2.20.0
Assigned To: Willie Walker
Orca Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-07-31 06:36 UTC by Tomas Cerha
Modified: 2008-07-22 19:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds the Speech Dispatcher backend to the list of known speech systems (870 bytes, patch)
2006-07-31 06:40 UTC, Tomas Cerha
committed Details | Review
The actual Speech Dispatcher backend module (5.17 KB, text/plain)
2006-07-31 07:06 UTC, Tomas Cerha
  Details
The actual Speech Dispatcher backend module (5.40 KB, text/plain)
2006-08-02 05:56 UTC, Tomas Cerha
  Details
Speech Dispatcher backend module with callback support (7.68 KB, text/plain)
2007-02-28 09:42 UTC, Tomas Cerha
  Details
Patch to make this work with saving/restoring user preferences (1.42 KB, patch)
2007-05-14 17:58 UTC, Willie Walker
committed Details | Review
Patch from Tomas Cerha (1.60 KB, patch)
2007-05-14 18:04 UTC, Willie Walker
none Details | Review

Description Tomas Cerha 2006-07-31 06:36:45 UTC
This is a patch to add Speech Dispatcher support to Orca.  To make it work, you need a Speech Dispatcher 0.6.1 (see http://www.freebsoft.org/speechd).
Comment 1 Tomas Cerha 2006-07-31 06:40:56 UTC
Created attachment 69944 [details] [review]
Adds the Speech Dispatcher backend to the list of known speech systems
Comment 2 Tomas Cerha 2006-07-31 07:06:45 UTC
Created attachment 69946 [details]
The actual Speech Dispatcher backend module
Comment 3 Willie Walker 2006-07-31 14:42:06 UTC
Thanks for contributing this!  I have a few questions:

1) Will you be able to implement speech progress callbacks?  These are important for things such as positioning the cursor in a text area when the user interrupts speech and highlighting text as it is spoken.

2) Can you make it so this will be more "bullet proof" in the absence of speechd?  For example, I see an "import speechd" that will obviously fail if speech dispatcher is not installed.

Thanks again.
Comment 4 Tomas Cerha 2006-08-02 05:56:05 UTC
Created attachment 70056 [details]
The actual Speech Dispatcher backend module

This is an improved version, which doesn't raise an exception if the `speechd' Python module is not installed.  The getSpeechServer() method just returns None and getSpeechServers() returns an empty list.
Comment 5 Tomas Cerha 2006-08-02 06:04:21 UTC
Comment on attachment 70056 [details]
The actual Speech Dispatcher backend module

Also a message 
"Speech Dispatcher interface not installed." is logged with the LEVEL_SEVERE priority on an attempt to instantiate the server when the `speechd' module can not be imported.  Hope that's ok with such a high priority, since it only happens when running orca setup or when starting orca after having ths backend previously selected.
Comment 6 Willie Walker 2006-08-07 13:51:59 UTC
Hi Tomas: thanks very much for your work in this space.  Once the drive to GNOME 2.16 has passed, we should start an overall discussion on what it means to center on SpeechDispatcher.
Comment 7 Willie Walker 2006-08-07 13:54:25 UTC
Comment on attachment 70056 [details]
The actual Speech Dispatcher backend module

This will need to support callbacks to allow Orca to provide visual feedback of what is being spoken and also to position the cursor when the user interrupts speech.
Comment 8 Willie Walker 2006-08-07 13:55:52 UTC
Comment on attachment 69944 [details] [review]
Adds the Speech Dispatcher backend to the list of known speech systems

This is dependent upon the other patch to include speech dispatcher.  I think maybe it might be nice to include both in a single patch so we can more easily track the two.
Comment 9 Tomas Cerha 2006-08-07 14:49:44 UTC
Well, do you know how to do that?  I tried passing -N to cvs diff, but it doesn't seem to include the added file in the diff.  That's why I posted the new file as a separate attachment.
Comment 10 Willie Walker 2006-08-07 15:04:34 UTC
Good point!  If CVS doesn't know about the file, then a cvs diff isn't going to find it.  If you do a "cvs add" on the file, it should hopefully show up.  Note that the "add" should not affect the repository until a "commit" is done, so it should be safe (as least as far as I understand the CVS docs).
Comment 11 Tomas Cerha 2006-08-08 07:43:00 UTC
cvs [server aborted]: "add" requires write access to the repository.
Comment 12 Willie Walker 2006-08-08 08:16:18 UTC
Thanks for checking.  Oh well...keep it separate then.  Thanks again.
Comment 13 Willie Walker 2006-09-07 01:34:22 UTC
Tomas:  thanks again very much for your work here!  We're very interested in getting this support into Orca, but we really need callbacks.  When will callbacks become available?
Comment 14 Willie Walker 2006-10-15 00:25:52 UTC
Add accessibility keyword.  Apologies for spam.
Comment 15 Tomas Cerha 2007-02-28 09:42:37 UTC
Created attachment 83532 [details]
Speech Dispatcher backend module with callback support

This version adds callback support and attempts to set the initial language according to the current locale.  Speech Dispatcher 0.6.2 is required (released on Feb 27, 2007).
Comment 16 Rich Burridge 2007-02-28 15:15:49 UTC
Thanks Tomas!
Comment 17 Willie Walker 2007-03-01 00:53:49 UTC
The following string is unfortunately exposed to the user and needs to be marked for translation:

    def getFactoryName():
        return "Speech Dispatcher"
 
GNOME 2.18 is in a string freeze right now, and we recently had to pull our nautilus functionality from GNOME 2.18 regarding related issues.  I'm going to mark the target for this as Orca 2.19.0, which we will hopefully do shortly (possibly before the official GNOME 2.18 release is out).
Comment 18 Willie Walker 2007-03-13 16:58:32 UTC
Committed.  It took me a while to figure out what was necessary to actually get Speech Dispatcher working (I needed to run both "festival --server" and "speech-dispatcher" as root), but I eventually got at least that part working.  I also needed to build/install speech-dispatcher 0.6.2, which was a little challenging since the Python bindings didn't seem to install automatically (I had to manually run 'sudo python setup.py install' from the src/python directory).

All in all, it seems to work, with the exception of callbacks not working properly.  If you want to test this, try bringing up a document in gedit.  Press Insert+KP_Plus.  Orca should read all the lines in the file, starting wherever the caret is.  I've found it only reads the current line, which is usually an indicator that callbacks are not working.  I added a print statement to the callback method:

            def callback(type, index_mark=None):
                # This callback is called in Speech Dispatcher listener thread.
                # No subsequent Speech Dispatcher interaction is allowed here,
                # so we pass the calls to the gidle thread.
--->            print "CALLBACK", type, index_mark
                t = self._callback_type_map[type]
                if t == speechserver.SayAllContext.PROGRESS:
                    if index_mark:
                        context.currentOffset = int(index_mark)
                    else:
                        context.currentOffset = context.startOffset
                elif t == speechserver.SayAllContext.COMPLETED:
                    context.currentOffset = context.endOffset
                gobject.idle_add(orca_callback, context, t)
                if t == speechserver.SayAllContext.COMPLETED:
                    gobject.idle_add(self._say_all, iterator, orca_callback)
            self._speak(context.utterance, acss, callback=callback,
                        event_types=self._callback_type_map.keys())
  
I'm seeing the following output when I press Insert+KP_Plus and then not pressing anything:

CALLBACK begin None
CALLBACK cancel None
CALLBACK begin None
CALLBACK cancel None

I also added the following line to the _cancel method:

    def _cancel(self):
--->    print "CANCEL"
        self._client.cancel()

Since this output doesn't appear in the output above, this doesn't seem to be what is causing the cancel to be sent to the callback.

Can you take a look at this please?
Comment 19 Tomas Cerha 2007-03-14 07:21:21 UTC
Hello, you may also consider installing the following packages from Debian experimental:

  * speech-dispatcher
  * speech-dispatcher-festival
  * python-speechd

As to the problem you describe, it doesn't occur on my system.  Could you please try configuring Speech Dispatcher to use the Espeak driver?  Just uncomment the line:

AddModule "espeak-generic" "sd_generic" "espeak-generic.conf" "/var/log/speech-dispatcher/espeak.log"

in /etc/speech-dispatcher/speechd.conf and set the DefaultModule to espeak-generic.  If you have the "espeak" binary installed, espeak should be used by Speech Dispatcher after you restart it.  You may test that using the spd-say program.  This will tell us, whether the problem is in your festival setup or somewhere else.  If it persists, could you please set the LogLevel in speechd.conf to 5 and send me your log (STDERR or /var/log/speech-dispatcher/speech-dispatcher.log)?

Thank you for cooperation.
Comment 20 Tomas Cerha 2007-03-14 07:40:52 UTC
Hello, I made one more observation.  I can see the behavior you describe when I use Speech Dispatcher with Flite.  This is probably a bug in the Flite driver.  So my suspiction is that your Speech Dispatcher doesn't use Festival, but Flite, which is the default.  Can you make sure, that you have DefaultModule set to festival in /etc/speech-dispatcher/speechd.conf and that it is used (problems should be logged even with LogLevel 3)?  Also make sure you have the package festival-freebsoft-utils (available from ubuntu).  Also, instead of having to run festival manually, you may enable running festival server on startup by uncommenting the line "exit 0" at the beginning of /etc/init.d/festival.  Well, if you are fine with the espeak driver, you don't need to care about Festival at all...
Comment 21 Willie Walker 2007-05-14 17:30:52 UTC
> Hello, I made one more observation.  I can see the behavior you describe when I
> use Speech Dispatcher with Flite.  This is probably a bug in the Flite driver. 
> So my suspiction is that your Speech Dispatcher doesn't use Festival, but
> Flite, which is the default.  Can you make sure, that you have DefaultModule
> set to festival in /etc/speech-dispatcher/speechd.conf and that it is used
> (problems should be logged even with LogLevel 3)?

I was finally able to spend a little time with this and ended up just jumping to the espeak support.  Seems to work a lot better, and SayAll also seems to be working.  I had to modify the speechdispatcherfactory.py module a little bit (will attach a patch soon), and I also needed to muck around with the SpeechDispatcher build.  The SpeechDispatcher build seems to want to stuff the Python module under /lib and happily ignores --prefix.  As such, I needed to move the module under /usr/local by hand.
Comment 22 Willie Walker 2007-05-14 17:58:12 UTC
Created attachment 88169 [details] [review]
Patch to make this work with saving/restoring user preferences

Possible fix.  Tomas might have something better.
Comment 23 Willie Walker 2007-05-14 18:04:43 UTC
Created attachment 88170 [details] [review]
Patch from Tomas Cerha

Similar patch, just executed differently.  :-)
Comment 24 Tomas Cerha 2007-05-14 18:12:12 UTC
(In reply to comment #23)

I actually like your patch better. :-)  I guess the server id should be unique, so it should be fine to use it for lookup.  In fact, I doubt there will ever be more than one instance of the server anyway.
Comment 25 Willie Walker 2007-05-14 18:29:02 UTC
Committed the agreed upon patch (thanks Tomas!).  I think we should also consider closing this bug as FIXED and then open more specific SpeechDispatcher bugs as they arise.  Tomas, are you OK with that?
Comment 26 Tomas Cerha 2007-05-14 18:51:04 UTC
(In reply to comment #25)
> Tomas, are you OK with that?

Yes, definitely.  Thanks for cooperation.

Comment 27 Willie Walker 2007-05-14 18:56:29 UTC
Closing as FIXED.  Thanks Tomas!