I am glad to announce new small project that got first release – QtSpeech.
This is library providing Qt-like interface to system TTS (text-to-speech) engines to allow your application to say “Hello World!”.
Current API is very simple.
First you need to include <QtSpeech>. Then if your application just needed to say something synchronously (execution will wait in the point until speech is finished) you can use such code:
1 | #include <QtSpeech> |
2 | |
3 | QtSpeech voice; |
4 | voice.say( "Hello World!" ); |
If you would like to do this in asynchronous way (so your application is not blocked meanwhile) just use tell() call:
1 | QtSpeech * voice = new QtSpeech( this ); |
2 | voice->tell( "Hello asynchronous world!" ); |
If you need to invoke a slot at the end, use:
1 | voice->tell( "Hello!" , this , SLOT(onSpeechFinished())); |
Also you have possibility to get list of voices and choose voice from available in your system:
1 | QtSpeech::VoiceNames vs = QtSpeech::names() |
Current implementation support Windows using SAPI and Mac. I have plans to extend API to include more functionality but will try to choose what is common on all platforms.
Link to repository in Gitorius: http://gitorious.org/qt-speech