QtSpeech会让Qt说话
来源:互联网 发布:java class 加密 编辑:程序博客网 时间:2024/04/28 00:43
转摘地址:http://qt.csdn.net/articles.aspx?pointid=930&pointid2=
想要多了解QtSpeech,那么随着本文的文字往下走吧!QtSpeech是一个Qt封装的跨平台TTS(文本变成语音输出)API,在不同平台下利用系统自带的TTS引擎。在Windows下使用SAPI, 在Mac下使用SpeechSynthesis,而在Linux下使用 Festival.
QtSpeech的官方项目主页在: http://lynxline.com/projects/qtspeech
源码git仓库地址则在: http://gitorious.org/qt-speech
API的使用非常简单,如果你是同步调用,发音结束后返回,可以使用QtSpeech::say
- <blockquote>#include <QtSpeech>
- …
- QtSpeech voice;
- voice.say(“Hello World!”);
如果是异步调用(发音不会阻塞程序运行),则可以使用QtSpeech::tell
- <blockquote>#include <QtSpeech>
- …
- QtSpeech * voice = new QtSpeech(this);
- voice->tell(“Hello asynchronous world!”);
如果使用QtSpeech::tell,还可以加入slot函数,在发音结束时回调该slot
- voice->tell(“Hello!”, this, SLOT(onSpeechFinished()));
VoiceName可以用于设定发音类型的,比如英语或者法语,意大利语等
- QtSpeech::VoiceNames vs = QtSpeech::voices();
//不过,目前从源代码来看只支持英语
在ubuntu下编译
- $ #qtspeech 依赖的tts是festival,所以需要先安装
- $ sudo apt-get install festival festival-dev
- $ sudo apt-get install libasound2-dev
- $ git clone git://gitorious.org/qt-speech/qt-speech.git
- $ cd qt-speech/
- $ qmake QtSpeech.pro
- $ make
- $ #test
目录下有可以测试的例子,记得把音箱打开
小结:QtSpeech就介绍到这里吧,注意了,头文件得自己手动添加,如果还出错的话,那就是你没装Qt开发包!!!不要饭低级错误哦。
QtSpeech, say “Hello World!”
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
- QtSpeech会让Qt说话
- QtSpeech会让Qt说话
- QtSpeech会让Qt说话
- QtSpeech会让Qt说话
- 让你的Qt文本说话------QtSpeech
- 让你的键盘会说话!
- 让你的程序会说话
- 让你的键盘会说话!
- 让算法会说话之冒泡排序
- 让算法会说话之插入排序
- 让算法会说话之希尔排序
- 让算法会说话之堆排序
- 让算法会说话之归并排序
- 让算法会说话之快速排序
- 会说话
- 会说话
- Windows XP中让你的键盘会说话
- (转)会说话让你少奋斗20年,说话的技巧
- Spring的事务管理难点剖析(7):数据连接泄漏
- GNU Binutils
- Android优化之软引用和弱引用
- c#经典面试题—猫叫,主人醒,老鼠跑(事件的处理)
- 关于typedef的用法总结(真理真是越辩越明)
- QtSpeech会让Qt说话
- jquery-direct.js 大大简化js 异步调用服务器端的方法
- Cocos2d-x:2.x与1.x的版本差别集锦
- 第十四章: 会话、用户和注册****************8888
- iOS开发 - 应用内打开第三方应用并传值
- CString,TCHAR ,string,char等数据类型转换
- 计算机专业教学进度一览表
- iOS学习之UIActionSheet的使用
- 第九周项目3型号图(e)