语音开发.docVIP

  • 15
  • 0
  • 约1.31万字
  • 约 15页
  • 2017-06-02 发布于河南
  • 举报
语音开发

Android 开发示例 Android平台,在Eclipse中打开SDK中MSCDemo工程后 A语音听写 关键的实现代码在于IatDemoAcitivity.java文件中    iatDialog = new RecognizerDialog(this, appid= + getString(R.string.app_id)); iatDialog.setListener(this); iatDialog.show(); 识别结果的回调在OnResult中,需开发者实现。 B关键词识别 关键的实现代码在于IsrDemoAcitivity.java文件中,与语音听写服务区别的是,新的关键词在识别之前需要用上传控件传递至服务端。    UploadDialog uploadDialog = new UploadDialog(this, appid=+ getString(R.string.app_id)); uploadDialog.setListener(this); uploadDialog.setContent(keys.getBytes(utf-8), dtt=keylist, contact); uploadDialog.show(); RecognizerDialog isrDialog = new RecognizerDialog(this, appid= + getString(R.string.app_id)); isrDialog.setListener(this); isrDialog.show(); 识别结果的回调同样在OnResult接口中实现。 C语音合成 关键的实现代码在于TtsDemoActivity.java文件中    SynthesizerDialog ttsDialog = new SynthesizerDialog(this, appid=+ getString(R.string.app_id)); ttsDialog.setText(“hello world!”,null); ttsDialog.show(); ? 以Windows下的开发为例,给出了语音合成、语音识别和语音听写的编程示例。 语音合成开发例程 #include stdio.h #include string.h #include qtts.h #define END_SYNTH( reason ) \ { \ ret = QTTSSessionEnd( session_id, #reason ); \ if( 0 != ret ) \ { \ printf(QTTSSessionEnd failed, error code is %d, ret ); \ } \ \ ret = QTTSFini(); \ if( 0 != ret ) \ { \ printf(QTTSFini failed, error code is %d, ret ); \ } \ } int main() { const char* configs = NULL; const char* session_id = NULL; const char* synth_params = NULL; const char* synth_text = NULL; unsigned int text_len = 0; const char* synth_speech = NULL; unsigned int synth_speech_len = 0; FILE* f_speech = NULL; int synth_status = 0; int ret = 0; printf( ===================================================================\n Mobile Speech Platform 2.0 Client SDK Demo for TTS \n ===================================================================\n ); /* 初始化 */ configs = server_url=dev.voicecloud.cn/index.htm, timeout=10000, coding_libs=speex.dll; ret = QTTSInit( configs ); if( 0 != ret ) { printf( QTTSInit failed, error code is %d, ret ); return -1; } /* 开始一路会话,使用会话模式 */ synth_params

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档