Main Page
Modules
Namespaces
Classes
Files
File List
File Members
include
tts
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
"
7
#include "
asr/xunfei/msp_errors.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
33
static
wave_pcm_hdr
default_wav_hdr
= {
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
38
class
TextToSpeech
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
qtts.h
iFLY Speech Synthesizer Header File
TextToSpeech
Definition:
text_to_speech.h:38
_wave_pcm_hdr
Definition:
text_to_speech.h:14
_wave_pcm_hdr::size_8
int size_8
Definition:
text_to_speech.h:17
_wave_pcm_hdr::riff
char riff[4]
Definition:
text_to_speech.h:16
TextToSpeech::src_text
const char * src_text
Definition:
text_to_speech.h:43
_wave_pcm_hdr::fmt_size
int fmt_size
Definition:
text_to_speech.h:20
TextToSpeech::text_audio_map
static map< string, string > text_audio_map
Definition:
text_to_speech.h:45
_wave_pcm_hdr::samples_per_sec
int samples_per_sec
Definition:
text_to_speech.h:23
TextToSpeech::audioFile
string audioFile
Definition:
text_to_speech.h:44
_wave_pcm_hdr::bits_per_sample
short int bits_per_sample
Definition:
text_to_speech.h:27
default_wav_hdr
static wave_pcm_hdr default_wav_hdr
Definition:
text_to_speech.h:33
msp_cmn.h
Mobile Speech Platform Common Interface Header File.
msp_errors.h
_wave_pcm_hdr::block_align
short int block_align
Definition:
text_to_speech.h:26
_wave_pcm_hdr::channels
short int channels
Definition:
text_to_speech.h:22
_wave_pcm_hdr::fmt
char fmt[4]
Definition:
text_to_speech.h:19
base_path
const std::string base_path
Definition:
baidu_asr_example.cpp:5
_wave_pcm_hdr::data
char data[4]
Definition:
text_to_speech.h:28
wave_pcm_hdr
struct _wave_pcm_hdr wave_pcm_hdr
_wave_pcm_hdr::format_tag
short int format_tag
Definition:
text_to_speech.h:21
_wave_pcm_hdr::avg_bytes_per_sec
int avg_bytes_per_sec
Definition:
text_to_speech.h:24
_wave_pcm_hdr::wave
char wave[4]
Definition:
text_to_speech.h:18
_wave_pcm_hdr::data_size
int data_size
Definition:
text_to_speech.h:29
TextToSpeech::basePath
string basePath
Definition:
text_to_speech.h:42
xbot_talker
Author(s): wangxiaoyun
autogenerated on Sat Oct 10 2020 03:27:54