I want to present a small but convenient module for cross-platform use of TTS (text-to-speech). Currently the main platforms are supported:
* Windows using SAPI,
* Unixes, using the Festival project,
* MacOSX using SpeechSynthesis
Since Windows and Mac use native API, all voice engines installed in the system will be automatically available to you. For Unix, everything is not so rosy, there is no common system, api, so the Festival project was just chosen, which gives good quality for the English language and the LGPL license. On a Mac, you can always count on a great Alex voice.
Using the library is very simple - so your application will finally say “Hello World!”.
You need to connect <QtSpeech>. Now when your application needs to say something synchronously (the performance will wait at this point until the voice runs) the following code is enough:
#include <QtSpeech> ... QtSpeech voice; voice.say("Hello World!");
')
If asynchrony is needed (the application is not blocked) just use tell ():
QtSpeech * voice = new QtSpeech(this); voice->tell("Hello asynchronous world!");
If you need to work out a certain logic at the end:
voice->tell("Hello!", this, SLOT(onSpeechFinished()));
We can also get a list of votes in the system:
QtSpeech::VoiceNames vs = QtSpeech::names()
Now about the voices. The largest set of different voices and languages is sold by Acapela for Windows and Mac, for Mac they are distributed under a different name Infovox iVox. There are also voices from IBM and a couple more companies. What is bad - you cannot include these voices in your program and distribute along with it, you need to negotiate with the company or buy their SDK if it is there. But for English, you can always count on the default voice (or start a festival).
The applications are the most varied. Need to voice something quick? Mechanical voice in a simple toy? Now cross-platform with Qt.
Plans: Make a version without reference to Qt (most likely to use boost: threads). More functionality - pause, and so on. But it will rather be only the functionality that will be available on all three platforms at once.
References:
1 Download, repository in Gitorius:
http://gitorious.org/qt-speech2 Project website:
http://lynxline.com/projects/qtspeech/