text_to_speech.h
Go to the documentation of this file.
1 #ifndef TEXT_TO_SPEECH_H_
2 #define TEXT_TO_SPEECH_H_
3 
4 #include <map>
5 #include <string>
6 #include "asr/xunfei/msp_cmn.h"
8 #include "asr/xunfei/qtts.h"
9 
10 using std::string;
11 using std::map;
12 
13 /* wav音频头部格式 */
14 typedef struct _wave_pcm_hdr
15 {
16  char riff[4]; // = "RIFF"
17  int size_8; // = FileSize - 8
18  char wave[4]; // = "WAVE"
19  char fmt[4]; // = "fmt "
20  int fmt_size; // = 下一个结构体的大小 : 16
21  short int format_tag; // = PCM : 1
22  short int channels; // = 通道数 : 1
23  int samples_per_sec; // = 采样率 : 8000 | 6000 | 11025 | 16000
24  int avg_bytes_per_sec; // = 每秒字节数 : samples_per_sec * bits_per_sample /
25  // 8
26  short int block_align; // = 每采样点字节数 : wBitsPerSample / 8
27  short int bits_per_sample; // = 量化比特数: 8 | 16
28  char data[4]; // = "data";
29  int data_size; // = 纯数据长度 : FileSize - 44
30 } wave_pcm_hdr;
31 
34  { 'R', 'I', 'F', 'F' }, 0, { 'W', 'A', 'V', 'E' }, { 'f', 'm', 't', ' ' }, 16, 1, 1, 44100, 88200, 2, 16,
35  { 'd', 'a', 't', 'a' }, 0
36 };
37 
39 {
40 private:
41  //读入文本的路径
42  string basePath;
43  const char* src_text;
44  string audioFile;
45  static map<string, string> text_audio_map;
46 
47 public:
48  TextToSpeech(const string& basePath, const char* src_text, const string& audioFile);
49  TextToSpeech();
50  TextToSpeech(const char* src_text);
51  static map<string, string> createMap();
52  ~TextToSpeech();
53  bool audioConverter(const std::string base_path, const char* src_text);
54  string getAudioFile(map<string, string> current_map);
55  int set_pcm_play(FILE* fp, wave_pcm_hdr* wav_header);
56  int play_wav(const string& file_path);
57 };
58 
59 #endif
iFLY Speech Synthesizer Header File
const char * src_text
static map< string, string > text_audio_map
string audioFile
short int bits_per_sample
static wave_pcm_hdr default_wav_hdr
Mobile Speech Platform Common Interface Header File.
short int block_align
short int channels
const std::string base_path
struct _wave_pcm_hdr wave_pcm_hdr
short int format_tag


xbot_talker
Author(s): wangxiaoyun
autogenerated on Sat Oct 10 2020 03:27:54