|
|
@@ -2609,9 +2609,9 @@ function handleEpisodeContent($originalContent) {
|
|
|
if ($timbreName) {
|
|
|
$timbre = DB::table('mp_timbres')->where('is_enabled', 1)->where('timbre_name', 'like', "%{$timbreName}%")->orderBy('id')->select('timbre_type', 'audio_url')->first();
|
|
|
if ($timbre) {
|
|
|
- $roleData['timbre_name'] = $timbreName;
|
|
|
- $roleData['timbre_type'] = getProp($timbre, 'timbre_type');
|
|
|
- $roleData['audio_url'] = getProp($timbre, 'audio_url');;
|
|
|
+ $roleData['voice_name'] = $timbreName;
|
|
|
+ $roleData['voice_type'] = getProp($timbre, 'timbre_type');
|
|
|
+ $roleData['voice_audio_url'] = getProp($timbre, 'audio_url');;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -2622,9 +2622,9 @@ function handleEpisodeContent($originalContent) {
|
|
|
$result['roles'][] = [
|
|
|
'role' => '旁白',
|
|
|
'description' => '负责叙述剧情、补充说明和情感渲染的非视觉角色。',
|
|
|
- 'timbre_name' => '旁白',
|
|
|
- 'timbre_type' => 'zh_male_linjiananhai_moon_bigtts',
|
|
|
- 'audio_url' => 'https://zw-audiobook.tos-cn-beijing.volces.com/demonstrate/zh_male_linjiananhai_moon_bigtts.wav'
|
|
|
+ 'voice_name' => '旁白',
|
|
|
+ 'voice_type' => 'zh_male_linjiananhai_moon_bigtts',
|
|
|
+ 'voice_audio_url' => 'https://zw-audiobook.tos-cn-beijing.volces.com/demonstrate/zh_male_linjiananhai_moon_bigtts.wav'
|
|
|
];
|
|
|
}
|
|
|
|
|
|
@@ -2748,12 +2748,15 @@ function handleEpisodeContent($originalContent) {
|
|
|
if (preg_match('/(?:尾帧描述|尾帧|结束帧|最后一帧|结尾画面|结束画面)[::]\s*([^\n]+)/u', $segmentContent, $tailFrameMatch)) {
|
|
|
$segmentData['tail_frame'] = trim($tailFrameMatch[1]);
|
|
|
}
|
|
|
+ $replaceEmptyArr = [];
|
|
|
// 新增:情感字段
|
|
|
if (preg_match('/(?:情感|情绪|感情)[::]\s*([^\n]+)/u', $segmentContent, $emotionMatch)) {
|
|
|
+ $replaceEmptyArr[] = trim($emotionMatch[0]);
|
|
|
$segmentData['emotion'] = trim($emotionMatch[1]);
|
|
|
}
|
|
|
// 新增:性别字段
|
|
|
if (preg_match('/(?:性别)[::]\s*([^\n]+)/u', $segmentContent, $genderMatch)) {
|
|
|
+ $replaceEmptyArr[] = trim($genderMatch[0]);
|
|
|
$genderStr = trim($genderMatch[1]);
|
|
|
if (strpos($genderStr, '男') !== false || $genderStr === '1') {
|
|
|
$segmentData['gender'] = '1';
|
|
|
@@ -2765,20 +2768,26 @@ function handleEpisodeContent($originalContent) {
|
|
|
}
|
|
|
// 新增:语速字段
|
|
|
if (preg_match('/(?:语速|说话速度)[::]\s*([-+]?[0-9]*\.?[0-9]+)/u', $segmentContent, $speedMatch)) {
|
|
|
+ $replaceEmptyArr[] = trim($speedMatch[0]);
|
|
|
$segmentData['speed_ratio'] = (float)trim($speedMatch[1]);
|
|
|
}
|
|
|
// 新增:音量字段
|
|
|
if (preg_match('/(?:音量|声音大小)[::]\s*([-+]?[0-9]*\.?[0-9]+)/u', $segmentContent, $loudnessMatch)) {
|
|
|
+ $replaceEmptyArr[] = trim($loudnessMatch[0]);
|
|
|
$segmentData['loudness_ratio'] = (float)trim($loudnessMatch[1]);
|
|
|
}
|
|
|
// 新增:情感强度字段
|
|
|
if (preg_match('/(?:情感强度|情绪强度)[::]\s*([0-9]+)/u', $segmentContent, $scaleMatch)) {
|
|
|
+ $replaceEmptyArr[] = trim($scaleMatch[0]);
|
|
|
$segmentData['emotion_scale'] = (int)trim($scaleMatch[1]);
|
|
|
}
|
|
|
// 新增:音调字段
|
|
|
if (preg_match('/(?:音调|音高)[::]\s*([-+]?[0-9]+)/u', $segmentContent, $pitchMatch)) {
|
|
|
+ $replaceEmptyArr[] = trim($pitchMatch[0]);
|
|
|
$segmentData['pitch'] = (int)trim($pitchMatch[1]);
|
|
|
}
|
|
|
+
|
|
|
+ $segmentData['segment_content'] = str_replace($replaceEmptyArr, '', $segmentContent);
|
|
|
|
|
|
$segments[] = $segmentData;
|
|
|
}
|