Skip to content

Commit

Permalink
Merge pull request #49 from Haruhiyuki/dev
Browse files Browse the repository at this point in the history
v0.3.1
  • Loading branch information
Haruhiyuki authored Oct 3, 2024
2 parents 66038ef + 422fe46 commit a814898
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def synthesize_audio(self, event=None):
convert_results = conveter.generate_rpy_elements()
tts = TTS(conveter)
parsed_sheets_tts = tts.filter_parsed_sheets_tts()
tts.synthesize_voice(parsed_sheets_tts)
tts.synthesize_voice(parsed_sheets_tts,'auto')
except VoiceException as err:
success_flag = False
showerror("合成错误", err.msg)
Expand Down
28 changes: 0 additions & 28 deletions config.json

This file was deleted.

Binary file not shown.
Binary file added dist/凉宫春日AVG开发套装v1.0.zip
Binary file not shown.
8 changes: 5 additions & 3 deletions handler/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def filter_parsed_sheets_tts(self):

for parsed_sheet in parsed_sheets:
filtered_rows = []
for row in parsed_sheet.row_values:
for original_row_index, row in enumerate(parsed_sheet.row_values):
# 检查当前行的 role_name
role_name = row[ElementColNumMapping.get('role_name')]
if role_name.strip():
Expand All @@ -43,7 +43,8 @@ def filter_parsed_sheets_tts(self):
filtered_row = {
'role_name': role_name,
'text': row[ElementColNumMapping.get('text')],
'voice_cmd': row[ElementColNumMapping.get('voice_cmd')]
'voice_cmd': row[ElementColNumMapping.get('voice_cmd')],
'original_row_index': original_row_index
}
filtered_rows.append(filtered_row)

Expand Down Expand Up @@ -103,6 +104,7 @@ def synthesize_voice(self,voice_tts_sheets,language):
role_name = row['role_name'] # 获取角色名
text = row['text'] # 获取文本
voice_cmd = row['voice_cmd'] # 获取语音指令
original_row_index = row['original_row_index']

# 获取对应的 ref_audio_path 和 prompt_text
audio_params = self.voice_cmd_mapping.get(voice_cmd, {})
Expand Down Expand Up @@ -135,7 +137,7 @@ def synthesize_voice(self,voice_tts_sheets,language):
if response.status_code == 200:
# 处理成功的音频流
audio_stream = response.content
audio_file_path = os.path.join(audio_folder, f"{role_name}_sheet{sheet_index+1}_row{row_index+8}_synthesized.wav")
audio_file_path = os.path.join(audio_folder, f"{role_name}_sheet{sheet_index+1}_row{original_row_index+8}_synthesized.wav")
with open(audio_file_path, "wb") as f:
f.write(audio_stream)
else:
Expand Down
Binary file modified test/剧本空表格.xlsx
Binary file not shown.

0 comments on commit a814898

Please sign in to comment.