WIN7下使用Qt调用微软TTS进行文本朗读
2011-09-02 17:32
579 查看
最近研究了下调用微软TTS引擎进行朗读的相关资料,发现其实很简单,特发文与众位博友共享。
首先看看微软MSDN官方文档是如何调用TTS的
TTS的框架已经搭好了,现在让我们试试TTS的魅力吧,稍后上传一个TTS的SAMPLE,可以下载下来玩玩!
![](http://images.cnblogs.com/cnblogs_com/rockhawk/201109/201109021736379001.jpg)
Win7 TTS 示例
首先看看微软MSDN官方文档是如何调用TTS的
Win7TTSWin7TTS::Win7TTS(void) : _binit(0), _bReading(0) { } Win7TTS::~Win7TTS(void) { } bool Win7TTS::initSpeech() { if(_binit) return true; _binit = this->_voice.setControl("96749377-3391-11D2-9EE3-00C04F797396"); if(_binit) { connect(&this->_voice,SIGNAL(signal(QString, int, void*)), this, SLOT(dealevent(QString, int, void*))); } return _binit; } bool Win7TTS::speak(QString & txt) { if(!_binit) return false; int result = this->_voice.dynamicCall("Speak(QString, SpeechVoiceSpeakFlags)", txt ,1).toInt(); _bReading = true; return result; } void Win7TTS::pause() { if(!_binit) return; _bReading = false; this->_voice.dynamicCall("Pause()"); } void Win7TTS::resume() { if(!_binit) return; _bReading = true; this->_voice.dynamicCall("Resume()"); } void Win7TTS::stop() { if(!_binit) return; _bReading = false; int result = this->_voice.dynamicCall("Speak(QString, SpeechVoiceSpeakFlags)", "" ,2).toInt(); } bool Win7TTS::isSpeaking() { return _bReading; } //rate range : -10 - 10 int Win7TTS::rate() { if(!_binit) return -99999; return this->_voice.property("Rate").toInt(); } void Win7TTS::setRate(int rate) { if(!_binit) return; this->_voice.dynamicCall("SetRate(int)", rate); } //volume range : 0 - 100 int Win7TTS::volume() { if(!_binit) return -99999; return this->_voice.property("Volume").toInt(); } void Win7TTS::setVolume(int value) { if(!_binit) return; this->_voice.dynamicCall("SetVolume(int)", value); } void Win7TTS::dealevent(QString name, int arc , void* argv) { if(name == "EndStream(int,QVariant)") { _bReading = false; emit speakComplete(); } }
TTS的框架已经搭好了,现在让我们试试TTS的魅力吧,稍后上传一个TTS的SAMPLE,可以下载下来玩玩!
![](http://images.cnblogs.com/cnblogs_com/rockhawk/201109/201109021736379001.jpg)
Win7 TTS 示例
相关文章推荐
- 【VC++技术杂谈004】使用微软TTS语音引擎实现文本朗读
- 使用微软TTS语音引擎实现文本朗读
- 【VC++技术杂谈004】使用微软TTS语音引擎实现文本朗读
- BlackBerry 10使用Google TTS做中文文本朗读,开发语言C++ Qt Cascade
- JS调用微软TTS DEMO朗读
- 使用Qt调用openssl 从内存中读取私钥对RSA密文进行解密
- Windows下 使用Python 3 调用讯飞 TTS 引擎实现文本转语音
- js调用微软TTS5.1语音引擎朗读
- 基于Qt5.5.0的sql数据库、SDK_tts文本语音朗读的CET四六级单词背诵系统软件的编写V1.0
- 基于Qt5.5.0的sql数据库、SDK_tts文本语音朗读的CET四六级单词背诵系统软件的编写V1.0
- Qt下使用微软的TTS
- Qt使用QTextEdit进行文本编辑实现查找高亮
- 使用微软T4 template进行代码生成
- 使用VS2010进行QT开发Hello,Qt的实现
- 使用微软WebMatrix进行Web开发 razor
- 使用JNI进行混合编程:在Java中调用C/C++本地库
- 使用朴素贝叶斯进行文本的分类
- [Algorithm] 使用SimHash进行海量文本去重
- [EntLib]微软企业库5.0 学习之路——第九步、使用PolicyInjection模块进行AOP—PART2——自定义Matching Rule
- Python 文本挖掘:使用gensim进行文本相似度计算