From b5a9035028ab74f4c16b215852f3d34695cda15c Mon Sep 17 00:00:00 2001 From: Sam Khoze <68170403+SamKhoze@users.noreply.github.com> Date: Thu, 13 Jun 2024 09:58:23 +0530 Subject: [PATCH] multiple language support added --- nodes.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nodes.py b/nodes.py index b7764a3..9370ad0 100644 --- a/nodes.py +++ b/nodes.py @@ -1077,18 +1077,18 @@ class TTS_generation: CATEGORY = "DeepFuze" # Category for the node in the UI - def generate_audio(self, audio, text,device): + def generate_audio(self, audio, text,device,supported_language): print(text) + language = supported_language.split("(")[1][:-1] try: - tts.to(device) - except:pass - try: - file_path = os.path.join(audio_path,str(time.time()).replace(".","")+".wav") - write(file_path,audio.sample_rate,audio.audio_data) - tts.tts_to_file(text=text, speaker_wav=file_path, language="en", file_path=file_path) - audio_file = AudioSegment.from_file(file_path, format="wav") - audio_data = AudioData(audio_file) - except:pass + ... + # tts.to(device) + except Exception as e:print(e) + file_path = os.path.join(audio_path,str(time.time()).replace(".","")+".wav") + write(file_path,audio.sample_rate,audio.audio_data) + tts.tts_to_file(text=text, speaker_wav=file_path, language=language, file_path=file_path) + audio_file = AudioSegment.from_file(file_path, format="wav") + audio_data = AudioData(audio_file) try: tts.to("cpu") except: pass