更新时间:2025-09-12 GMT+08:00
时间戳数据
功能介绍
实时语音合成服务在生成音频流的同时,可以生成每个汉字/英文单词的时间戳信息。该信息可用于视频字幕和驱动数字人口型。
参数设置
设置请求参数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': 'RESULT',
'trace_id': '39f02607-32d8-4c9f-8b20-11d4af28eecc',
'result':
[
{
'start_time': 0,
'end_time': 384,
'text': 'Nice',
'word_index': 0,
'phonemes': [
{'phoneme_index': 0, 'start_time': 0, 'end_time': 181, 'phoneme': 'n'},
{'phoneme_index': 1, 'start_time': 181, 'end_time': 288, 'phoneme': 'ay'},
{'phoneme_index': 2, 'start_time': 288, 'end_time': 384, 'phoneme': 's'}
]
},
{
'start_time': 384,
'end_time': 512,
'text': 'to',
'word_index': 1,
'phonemes': [
{'phoneme_index': 0, 'start_time': 384, 'end_time': 426, 'phoneme': 't'},
{'phoneme_index': 1, 'start_time': 426, 'end_time': 512, 'phoneme': 'ah0'}
]
},
{
'start_time': 512,
'end_time': 800,
'text': 'meet',
'word_index': 2,
'phonemes': [
{'phoneme_index': 0, 'start_time': 512, 'end_time': 608, 'phoneme': 'm'},
{'phoneme_index': 1, 'start_time': 608, 'end_time': 693, 'phoneme': 'iy'},
{'phoneme_index': 2, 'start_time': 693, 'end_time': 800, 'phoneme': 't'}
]
},
{
'start_time': 800,
'end_time': 1184,
'text': 'you.',
'word_index': 3,
'phonemes': [
{'phoneme_index': 0, 'start_time': 800, 'end_time': 864, 'phoneme': 'y'},
{'phoneme_index': 1, 'start_time': 864, 'end_time': 1013, 'phoneme': 'uw'},
{'phoneme_index': 2, 'start_time': 1013, 'end_time': 1184, 'phoneme': ''}
]
},
{
'start_time': 1184,
'end_time': 1284,
'text': '',
'word_index': 4,
'phonemes': [
{'phoneme_index': 0, 'start_time': 1184, 'end_time': 1284, 'phoneme': ''}
]
}
]
}
父主题: 语音合成结果响应