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 }
static CommonConfig & get_instance()
std::string log_path
void loginToXunfei(const std::string base_path)
const std::string base_path
Definition: tts_example.cpp:6
bool audioConverter(const std::string base_path, const char *src_text)
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