Skip to content

Commit

Permalink
Fix Reading
Browse files Browse the repository at this point in the history
  • Loading branch information
Artrajz committed Mar 7, 2024
1 parent 3bf6b61 commit b2f05cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions manager/TTSManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def gpt_sovits_infer(self, state, encode=True):
if check_is_none(refer_wav_path):
raise ValueError(f"The refer_wav_path:{refer_wav_path} in preset:{state.get('preset')} is None!")
refer_wav_path = os.path.join(config.abs_path, config.system.data_path, refer_wav_path)
prompt_text, prompt_lang = refer_preset.prompt_text, refer_preset.prompt_lang
state["prompt_text"], state["prompt_lang"] = refer_preset.prompt_text, refer_preset.prompt_lang

# 将reference_audio换成指定预设里的参考音频
state["reference_audio"] = refer_wav_path
Expand All @@ -550,7 +550,8 @@ def gpt_sovits_infer(self, state, encode=True):
presets = config.gpt_sovits_config.presets
state["prompt_lang"] = presets.get(next(iter(presets)), "auto")

state["reference_audio"], state["reference_audio_sr"] = librosa.load(state["reference_audio"], sr=None, dtype=np.float32)
state["reference_audio"], state["reference_audio_sr"] = librosa.load(state["reference_audio"], sr=None,
dtype=np.float32)
state["reference_audio"] = state["reference_audio"].flatten()

if state.get("lang").lower() == "auto":
Expand Down
2 changes: 1 addition & 1 deletion tts_app/voice_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def voice_gpt_sovits_api():
"lang": lang,
"speaker_lang": speaker_lang,
"reference_audio": reference_audio,
"reference_audio_sr": reference_audio_sr,
# "reference_audio_sr": reference_audio_sr,
"prompt_text": prompt_text,
"prompt_lang": prompt_lang,
"top_k": top_k,
Expand Down

0 comments on commit b2f05cc

Please sign in to comment.