Main Page
Modules
Namespaces
Classes
Files
File List
File Members
sdk_examples
xfei_tts_example
tts_example.cpp
Go to the documentation of this file.
1
#include "
tts/text_to_speech.h
"
2
#include "
common_config.h
"
3
#include <iostream>
4
#include <thread>
5
// base_path表示到xbot_talker的绝对或者相对路径.
6
const
std::string
base_path
=
"../../.."
;
7
8
int
main
(
int
argc,
char
** argv)
9
{
10
std::cout <<
"--------- xunfei tts demo ------------"
<< std::endl;
11
std::cout <<
"这是科大讯飞在线语音识别功能/离线语法识别的示例demo."
<< std::endl;
12
// 科大讯飞asr登录以及语法参数配置
13
CommonConfig
& xunfei_config =
CommonConfig::get_instance
();
14
xunfei_config.
loginToXunfei
(
base_path
);
15
TextToSpeech
tts_test;
16
string
text;
17
std::cout <<
" 输入想要进行语音合成的文字:"
;
18
std::cin >> text;
19
// log_path:合成的音频保存路径
20
std::string
log_path
=
base_path
+
"/cache/log"
;
21
tts_test.
audioConverter
(log_path, text.c_str());
22
}
TextToSpeech
Definition:
text_to_speech.h:38
CommonConfig::get_instance
static CommonConfig & get_instance()
Definition:
common_config.h:117
log_path
std::string log_path
Definition:
read_all_files_and_recog.cpp:13
CommonConfig::loginToXunfei
void loginToXunfei(const std::string base_path)
Definition:
common_config.cpp:7
CommonConfig
Definition:
common_config.h:103
text_to_speech.h
common_config.h
base_path
const std::string base_path
Definition:
tts_example.cpp:6
TextToSpeech::audioConverter
bool audioConverter(const std::string base_path, const char *src_text)
Definition:
text_to_speech.cpp:61
main
int main(int argc, char **argv)
Definition:
tts_example.cpp:8
xbot_talker
Author(s): wangxiaoyun
autogenerated on Sat Oct 10 2020 03:27:54