Activity Team/gst-plugins-espeak: Difference between revisions

Line 57: Line 57:
   import gtk
   import gtk
   import gst
   import gst
   import random<br>
   import random
  from gettext import gettext as _<br>
   def gstmessage_cb(bus, message, pipe):
   def gstmessage_cb(bus, message, pipe):
       if message.type in (gst.MESSAGE_EOS, gst.MESSAGE_ERROR):
       if message.type in (gst.MESSAGE_EOS, gst.MESSAGE_ERROR):
Line 65: Line 66:
       pipe = gst.parse_launch(pipeline)<br>
       pipe = gst.parse_launch(pipeline)<br>
       src = pipe.get_by_name('src')
       src = pipe.get_by_name('src')
       src.props.text = 'Hello world!'
       src.props.text = _('Hello, World!')
       src.props.pitch = random.randint(-100, 100)
       src.props.pitch = random.randint(-100, 100)
       src.props.rate = random.randint(-100, 100)<br>
       src.props.rate = random.randint(-100, 100)<br>
      voices = src.props.voices
      voice = voices[random.randint(0, len(voices)-1)]
      src.props.voice = voice[0]<br>
       bus = pipe.get_bus()
       bus = pipe.get_bus()
       bus.add_signal_watch()
       bus.add_signal_watch()