diff --git a/__pycache__/Combined.cpython-39.pyc b/__pycache__/Combined.cpython-39.pyc new file mode 100644 index 00000000..a82e826b Binary files /dev/null and b/__pycache__/Combined.cpython-39.pyc differ diff --git a/__pycache__/open_ai_voice.cpython-39.pyc b/__pycache__/open_ai_voice.cpython-39.pyc new file mode 100644 index 00000000..02348ea2 Binary files /dev/null and b/__pycache__/open_ai_voice.cpython-39.pyc differ diff --git a/combined_video.mp4 b/combined_video.mp4 index ff748a8e..5ac90e24 100644 --- a/combined_video.mp4 +++ b/combined_video.mp4 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:baf7e97014a436f30b41651d0b568a310c7d0a31105782d12eaaf686e5820a8c -size 97978577 +oid sha256:4d394ad66add93a31d0fcb575742c4c427b24262066cba7ae0451d1eca8c9ac0 +size 98029539 diff --git a/output.wav b/output.wav index 6f1c5657..d60f1903 100644 --- a/output.wav +++ b/output.wav @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ea2c33316b3ad6085e3adcc71a4c30eff4909c4f94beee63a864f1acdd11467f -size 1760640 +oid sha256:43089f1ee2894912d4b15989f3d179317852409a4da9210ffbdc7866be741333 +size 1564320 diff --git a/xtts.py b/xtts.py index 6b7b9113..864fd39b 100644 --- a/xtts.py +++ b/xtts.py @@ -35,8 +35,11 @@ def contect_gather(subject): print(response.choices[0].message.content) return response.choices[0].message.content -# Initialize TTS object +tts = True # Initialize tts as None initially + +# Initialize TTS object if tts is True if tts: + from TTS.api import TTS tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=False) # Function to convert text to voice @@ -44,8 +47,7 @@ def text_to_voice(text, speaker, language): selected_ai = model_var.get() if selected_ai == 1: text_to_voice_openai(text) - - else: + elif tts: # Check if tts is initialized before calling tts_to_file tts.tts_to_file(text=text, file_path="output.wav", speaker_wav=f"sounds/{speaker}", @@ -53,6 +55,8 @@ def text_to_voice(text, speaker, language): split_sentences=True ) play_audio("output.wav") + else: + print("TTS is not initialized. Set 'tts' to True and provide appropriate configuration.") # Function to play audio using pygame def play_audio(file_path): @@ -93,7 +97,7 @@ def process_data(): multi_line_data = multi_line_textbox.get("1.0", tk.END) text_to_voice(multi_line_data, selected_file, selected_language) print("Processing multi-line data, selected file, and selected language:", multi_line_data, selected_file, selected_language) - + combine_audio_video("output.wav", "original_video.webm", "combined_video.mp4") # Function to save video def save_video(): # Code to save video @@ -175,5 +179,5 @@ def display_output(): # Create save video button save_button = tk.Button(root, text="Save Video", command=combine_audio_video("output.wav", "original_video.webm", "combined_video.mp4")) save_button.grid(row=7, column=0, columnspan=2, padx=10, pady=10, sticky="ew") - +combine_audio_video("output.wav", "original_video.webm", "combined_video.mp4") root.mainloop()