时间戳数据
功能介绍
实时语音合成服务在生成音频流的同时,可以生成每个汉字/英文单词的时间戳信息。该信息可用于视频字幕和驱动数字人口型。
参数设置
设置请求参数subtitle为"word_level"或"phoneme_level"时,开启时间戳功能。
响应信息
|
名称 |
参数类型 |
说明 |
|---|---|---|
|
resp_type |
String |
响应类型。参数值为RESULT。 |
|
trace_id |
String |
服务内部的令牌,可用于在日志中追溯具体流程。 |
|
result |
List |
时间戳信息 |
|
名称 |
参数类型 |
说明 |
|---|---|---|
|
start_time |
Integer |
文本对应的合成音频的开始时间戳,单位是ms。 |
|
end_time |
Integer |
文本对应的合成音频的结束时间戳,单位是ms。 |
|
text |
String |
文本信息。 |
|
word_index |
Integer |
文本在整句中的位置,从0开始计数。 |
|
phonemes |
List |
音素时间戳信息,当subtitle取值为phoneme_level时,返回该信息。 |
|
名称 |
参数类型 |
说明 |
|---|---|---|
|
phoneme |
String |
音素文本信息。 |
|
start_time |
Integer |
音素对应的合成音频的开始时间戳,单位是ms。 |
|
end_time |
Integer |
音素对应的合成音频的结束时间戳,单位是ms。 |
|
phoneme_index |
Integer |
音素位置信息,从0开始。 |
示例
word_level
{
'resp_type': 'RESULT',
'trace_id': 'd34e3ccb-0383-4c76-a107-ec6ced44614f',
'result':
[
{'start_time': 43980, 'end_time': 44210, 'word_index': 10, 'text': '从'},
{'start_time': 44210, 'end_time': 45298, 'word_index': 11, 'text': '而'}
]
}
{
'resp_type': 'RESULT',
'trace_id': 'd34e3ccb-0383-4c76-a107-ec6ced44614f',
'result':
[
{'start_time': 0, 'end_time': 384, 'text': 'Nice', 'word_index': 0},
{'start_time': 384, 'end_time': 512, 'text': 'to', 'word_index': 1},
{'start_time': 512, 'end_time': 800, 'text': 'meet', 'word_index': 2},
{'start_time': 800, 'end_time': 1184, 'text': 'you.', 'word_index': 3},
{'start_time': 1184, 'end_time': 1284, 'text': '', 'word_index': 4}
]
}
phoneme_level
{
'resp_type': 'START',
'trace_id': '22706fed-ab0e-4167-a6c7-e4dbc59898b1',
'result':
[
{
'word_index': 217,
'text': '需',
'start_time': 458
'end_time': 650
"phonemes": [
{'phoneme_index': 0, 'start_time': 458, 'end_time': 602, 'phoneme': 'x'},
{'phoneme_index': 1, 'start_time': 602, 'end_time': 650, 'phoneme': 'v1'}
]
},
{
'word_index': 217,
'text': '要',
'start_time': 650
'end_time': 922
"phonemes": [
{'phoneme_index': 0, 'start_time': 650, 'end_time': 922, 'phoneme': 'iao4'}
]
}
]
}