This client library is designed to provide an ergonomic interface to the myriad of potential speech providers that are installed in a given session. The API is inspired by the W3C Web Speech API. It serves several purposes:
Language bindings are available through GObject Introspection. So this should work for any application, be it in C/C++, Python, Rust, ECMAscript, or Lua.
A minimal python example would look like this:
import gi
gi.require_version("Spiel", "1.0")
from gi.repository import GLib, Spiel
loop = GLib.MainLoop()
def _notify_speaking_cb(synth, val):
if not synth.props.speaking:
loop.quit()
speaker = Spiel.Speaker.new_sync(None)
speaker.connect("notify::speaking", _notify_speaking_cb)
utterance = Spiel.Utterance(text="Hello world.")
speaker.speak(utterance)
loop.run()
We use the Meson build system for building Spiel.
# Some common options
meson setup build
meson compile -C build
Once Spiel is built, to run test the Python example above or a similar GObject client, make sure you are inside the build environment by running meson devenv -C build
.
To install libspiel system wide without needing to run meson devenv
, run meson install -C build
There is an auto-generated API reference.