Activity Team/gst-plugins-espeak: Difference between revisions
| Line 54: | Line 54: | ||
==== Polyphony example ==== | ==== Polyphony example ==== | ||
import gtk | |||
import gst | |||
import random<br> | |||
def gstmessage_cb(bus, message, pipe): | |||
if message.type in (gst.MESSAGE_EOS, gst.MESSAGE_ERROR): | |||
pipe.set_state(gst.STATE_NULL)<br> | |||
def make_pipe(): | |||
pipeline = 'espeak name=src ! autoaudiosink' | |||
pipe = gst.parse_launch(pipeline)<br> | |||
src = pipe.get_by_name('src') | |||
src.props.text = 'Hello world!' | |||
src.props.pitch = random.randint(-100, 100) | |||
src.props.rate = random.randint(-100, 100)<br> | |||
bus = pipe.get_bus() | |||
bus.add_signal_watch() | |||
bus.connect('message', gstmessage_cb, pipe)<br> | |||
pipe.set_state(gst.STATE_PLAYING)<br> | |||
for i in range(10): | |||
make_pipe()<br> | |||
gtk.main() | |||
==== Track words example ==== | ==== Track words example ==== | ||