[Sugar-devel] Working text to speech example needed
James Simmons
nicestep at gmail.com
Sat Jan 23 13:55:56 EST 2016
James,
I actually had some standalone programs in the MYOSA book. It looks like
the problem is with importing gst. I get this stack trace:
[jsimmons at olpc Adding_TTS_gtk3]$ ./gst_simple_example.py
Traceback (most recent call last):
File "./gst_simple_example.py", line 24, in <module>
import gst
File "/usr/lib64/python2.7/site-packages/gst-0.10/gst/__init__.py", line
193, in <module>
from _gst import *
ImportError: could not import gobject (could not find _PyGObject_API object)
I have installed gstreamer-plugins-espeak:
Package gstreamer-plugins-espeak-0.4.0-7.fc23.x86_64 is already installed,
skipping.
The code I'm using is one of the examples written by Aleksey Lim:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import gst
def gstmessage_cb(bus, message, pipe):
if message.type in (gst.MESSAGE_EOS, gst.MESSAGE_ERROR):
pipe.set_state(gst.STATE_NULL)
pipeline = 'espeak text="Hello, World!" ! autoaudiosink'
pipe = gst.parse_launch(pipeline)
bus = pipe.get_bus()
bus.add_signal_watch()
bus.connect('message', gstmessage_cb, pipe)
pipe.set_state(gst.STATE_PLAYING)
Gtk.main()
You can't get much simpler than that.
I'll keep looking at this, but my guess is that something didn't get
installed.
James Simmons
On Sat, Jan 23, 2016 at 7:51 AM, James Simmons <nicestep at gmail.com> wrote:
> James,
>
> Correction, it looks like the Clock Activity uses Gst. You've given me
> some things to try out. Thanks.
>
> James Simmons
>
>
> On Fri, Jan 22, 2016 at 8:56 PM, James Cameron <quozl at laptop.org> wrote:
>
>> G'day James,
>>
>> Here's some ideas.
>>
>> Can you try the imports by hand in a Python interpreter to find which
>> are failing and why?
>>
>> Can you remove your exception handlers temporarily to find out whether
>> the import is failing, or something else?
>>
>> What environment are you developing within?
>>
>> Can you use 'from sugar3.speech import SpeechManager'?
>>
>>
>> https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/speech.py
>>
>> See example of use, the Clock activity:
>>
>> https://github.com/godiard/clock-activity/blob/master/speaker.py
>>
>> Can you check you are looking at latest Speak source? It looks
>> different to yours. See Speech activity on GitHub:
>>
>> https://github.com/godiard/speak/blob/master/local_espeak.py
>>
>> On Fri, Jan 22, 2016 at 08:21:21PM -0600, James Simmons wrote:
>> > I have been neglecting my Sugar Activities for a long time, and I'm
>> trying to
>> > get them back in shape and using GTK3. I find that my Read Etexts
>> Activity, one
>> > of the first to use Aleksey Lim's gstreamer for espeak, no longer
>> works. I have
>> > code in there which is supposed to detect the presence of the gst espeak
>> > package and use it if available and hide the speech buttons on the
>> toolbar if
>> > it cannot.
>> >
>> > Needless to say, the buttons are hidden.
>> >
>> > I'm looking for Activities that use speech and work. The obvious
>> candidate,
>> > Speak, has code in Git that looks very much like the code I'm using. I
>> saw
>> > several versions in Git and they all use similar code:
>> >
>> > [1]http://git.sugarlabs.org/readetexts/mainline/blobs/master/speech.py
>> >
>> > shows the code I use to detect whether gst-plugins-espeak will work.
>> The log
>> > messages show it disabled.
>> >
>> > I thought updating the code to use Gst might be the answer, but I don't
>> have
>> > that working either.
>> >
>> > Are there any working applications that use gst-plugins-espeak?
>> >
>> > James Simmons
>> >
>> > References:
>> >
>> > [1] http://git.sugarlabs.org/readetexts/mainline/blobs/master/speech.py
>>
>> > _______________________________________________
>> > Sugar-devel mailing list
>> > Sugar-devel at lists.sugarlabs.org
>> > http://lists.sugarlabs.org/listinfo/sugar-devel
>>
>>
>> --
>> James Cameron
>> http://quozl.netrek.org/
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20160123/48e1fefd/attachment.html>
More information about the Sugar-devel
mailing list