drewThomasson
commited on
Commit
•
42d3e4d
1
Parent(s):
d9fb089
modified the yes/no to be y/n and made it auto-wipe the audiobook folder
Browse files- Headless_VoxNovel.py +37 -27
Headless_VoxNovel.py
CHANGED
@@ -922,6 +922,9 @@ def check_and_wipe_folder(directory_path):
|
|
922 |
#response = messagebox.askyesno("Confirm Deletion", "Audio clips from a previous session have been found. Do you want to wipe them?")
|
923 |
#root.destroy() # Destroy the tkinter instance
|
924 |
response = input("Audio clips from a previous session have been found. Do you want to wipe them? (yes/no): ").strip().lower()
|
|
|
|
|
|
|
925 |
|
926 |
|
927 |
if response == 'yes': # If the user types 'yes'
|
@@ -1152,8 +1155,9 @@ def select_voices():
|
|
1152 |
print(f"{index}. {speaker}: {voice}")
|
1153 |
|
1154 |
# Ask if user wants to change any selection
|
1155 |
-
|
1156 |
-
|
|
|
1157 |
break
|
1158 |
|
1159 |
# Get user input for which speaker to change
|
@@ -1687,11 +1691,12 @@ def select_tts_model():
|
|
1687 |
|
1688 |
while True:
|
1689 |
print(f"The TTS model currently selected is {current_model}.")
|
1690 |
-
|
|
|
1691 |
|
1692 |
-
if response == '
|
1693 |
return current_model
|
1694 |
-
elif response == '
|
1695 |
print("Available models:")
|
1696 |
for model in all_models:
|
1697 |
print(model)
|
@@ -1704,7 +1709,7 @@ def select_tts_model():
|
|
1704 |
else:
|
1705 |
print("Invalid model. Please select a model from the list.")
|
1706 |
else:
|
1707 |
-
print("Please answer '
|
1708 |
|
1709 |
|
1710 |
|
@@ -1717,8 +1722,8 @@ from tkinter import filedialog
|
|
1717 |
|
1718 |
def clone_new_voice():
|
1719 |
while True:
|
1720 |
-
confirm = input("Do you want to clone a new voice? (
|
1721 |
-
if confirm == '
|
1722 |
voice_actor_name = input("Enter the name of the new voice actor: ")
|
1723 |
voice_actor_gender = input("Enter the gender of the new voice actor (M/F/?): ")
|
1724 |
new_voice_path = f"tortoise/voices/{voice_actor_name}.{voice_actor_gender}"
|
@@ -1736,19 +1741,19 @@ def clone_new_voice():
|
|
1736 |
else:
|
1737 |
print("Voice actor folder already exists.")
|
1738 |
|
1739 |
-
repeat = input("Do you want to clone another new voice? (
|
1740 |
-
if repeat != '
|
1741 |
break
|
1742 |
-
elif confirm == '
|
1743 |
break
|
1744 |
else:
|
1745 |
-
print("Please answer '
|
1746 |
|
1747 |
|
1748 |
def add_fine_tuned_model():
|
1749 |
while True:
|
1750 |
-
confirm = input("Do you want to add a fine-tuned XTTS model to a voice actor? (
|
1751 |
-
if confirm == '
|
1752 |
base_directory = "tortoise/voices/"
|
1753 |
folders = [folder for folder in os.listdir(base_directory) if os.path.isdir(os.path.join(base_directory, folder))]
|
1754 |
|
@@ -1773,13 +1778,13 @@ def add_fine_tuned_model():
|
|
1773 |
else:
|
1774 |
print("The specified directory does not exist. Please check the path and try again.")
|
1775 |
|
1776 |
-
repeat = input("Do you want to add another fine-tuned model? (
|
1777 |
-
if repeat != '
|
1778 |
break
|
1779 |
-
elif confirm == '
|
1780 |
break
|
1781 |
else:
|
1782 |
-
print("Please answer '
|
1783 |
|
1784 |
|
1785 |
def ask_if_user_wants_to_add_fine_tuned_xtts_model_or_clone_a_voice():
|
@@ -1787,6 +1792,7 @@ def ask_if_user_wants_to_add_fine_tuned_xtts_model_or_clone_a_voice():
|
|
1787 |
print("\n1. Clone a new voice")
|
1788 |
print("2. Add a fine-tuned XTTS model to a voice actor")
|
1789 |
print("3. Skip/Proceed to voice selection")
|
|
|
1790 |
choice = input("Enter your choice #: ")
|
1791 |
|
1792 |
if choice == '1':
|
@@ -1815,8 +1821,9 @@ def select_language_terminal():
|
|
1815 |
language = default_language
|
1816 |
|
1817 |
# Ask user to change the language
|
1818 |
-
|
1819 |
-
|
|
|
1820 |
# List available languages
|
1821 |
languages = ['en', 'es', 'fr', 'de', 'it', 'pt', 'pl', 'tr', 'ru', 'nl', 'cs', 'ar', 'zh-cn', 'hu', 'ko', 'ja', 'hi'] # Extend as needed
|
1822 |
print("Available languages:")
|
@@ -1833,8 +1840,9 @@ def select_language_terminal():
|
|
1833 |
print("Invalid selection. Please try again.")
|
1834 |
|
1835 |
# Confirm the selection
|
1836 |
-
|
1837 |
-
|
|
|
1838 |
print(f"Language set to {language}.")
|
1839 |
else:
|
1840 |
print("Language change canceled. Using default English.")
|
@@ -1862,11 +1870,13 @@ def generate_audio():
|
|
1862 |
select_voices()
|
1863 |
selected_tts_model = select_tts_model()
|
1864 |
#This will ask the user in the terminal if they want to generate all of the audio with only the narrerator's voice
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
|
|
|
|
1870 |
|
1871 |
global current_language
|
1872 |
current_language = select_language_terminal()
|
|
|
922 |
#response = messagebox.askyesno("Confirm Deletion", "Audio clips from a previous session have been found. Do you want to wipe them?")
|
923 |
#root.destroy() # Destroy the tkinter instance
|
924 |
response = input("Audio clips from a previous session have been found. Do you want to wipe them? (yes/no): ").strip().lower()
|
925 |
+
#auto set it to wipe the folder
|
926 |
+
print("Auto-wiping... setting to yes")
|
927 |
+
response = 'yes'
|
928 |
|
929 |
|
930 |
if response == 'yes': # If the user types 'yes'
|
|
|
1155 |
print(f"{index}. {speaker}: {voice}")
|
1156 |
|
1157 |
# Ask if user wants to change any selection
|
1158 |
+
print("Would you like to change any voice assignments? (y/n): ")
|
1159 |
+
change = input("Would you like to change any voice assignments? (y/n): ").lower()
|
1160 |
+
if change != 'y':
|
1161 |
break
|
1162 |
|
1163 |
# Get user input for which speaker to change
|
|
|
1691 |
|
1692 |
while True:
|
1693 |
print(f"The TTS model currently selected is {current_model}.")
|
1694 |
+
print("Would you like to keep this model? (y/n): ")
|
1695 |
+
response = input("Would you like to keep this model? (y/n): ").strip().lower()
|
1696 |
|
1697 |
+
if response == 'y':
|
1698 |
return current_model
|
1699 |
+
elif response == 'n':
|
1700 |
print("Available models:")
|
1701 |
for model in all_models:
|
1702 |
print(model)
|
|
|
1709 |
else:
|
1710 |
print("Invalid model. Please select a model from the list.")
|
1711 |
else:
|
1712 |
+
print("Please answer 'y' or 'n'.")
|
1713 |
|
1714 |
|
1715 |
|
|
|
1722 |
|
1723 |
def clone_new_voice():
|
1724 |
while True:
|
1725 |
+
confirm = input("Do you want to clone a new voice? (y/n): ").lower()
|
1726 |
+
if confirm == 'y':
|
1727 |
voice_actor_name = input("Enter the name of the new voice actor: ")
|
1728 |
voice_actor_gender = input("Enter the gender of the new voice actor (M/F/?): ")
|
1729 |
new_voice_path = f"tortoise/voices/{voice_actor_name}.{voice_actor_gender}"
|
|
|
1741 |
else:
|
1742 |
print("Voice actor folder already exists.")
|
1743 |
|
1744 |
+
repeat = input("Do you want to clone another new voice? (y/n): ").lower()
|
1745 |
+
if repeat != 'y':
|
1746 |
break
|
1747 |
+
elif confirm == 'n':
|
1748 |
break
|
1749 |
else:
|
1750 |
+
print("Please answer 'y' or 'n'.")
|
1751 |
|
1752 |
|
1753 |
def add_fine_tuned_model():
|
1754 |
while True:
|
1755 |
+
confirm = input("Do you want to add a fine-tuned XTTS model to a voice actor? (y/n): ").lower()
|
1756 |
+
if confirm == 'y':
|
1757 |
base_directory = "tortoise/voices/"
|
1758 |
folders = [folder for folder in os.listdir(base_directory) if os.path.isdir(os.path.join(base_directory, folder))]
|
1759 |
|
|
|
1778 |
else:
|
1779 |
print("The specified directory does not exist. Please check the path and try again.")
|
1780 |
|
1781 |
+
repeat = input("Do you want to add another fine-tuned model? (y/n): ").lower()
|
1782 |
+
if repeat != 'y':
|
1783 |
break
|
1784 |
+
elif confirm == 'n':
|
1785 |
break
|
1786 |
else:
|
1787 |
+
print("Please answer 'y' or 'n'.")
|
1788 |
|
1789 |
|
1790 |
def ask_if_user_wants_to_add_fine_tuned_xtts_model_or_clone_a_voice():
|
|
|
1792 |
print("\n1. Clone a new voice")
|
1793 |
print("2. Add a fine-tuned XTTS model to a voice actor")
|
1794 |
print("3. Skip/Proceed to voice selection")
|
1795 |
+
print("Enter your choice #: ")
|
1796 |
choice = input("Enter your choice #: ")
|
1797 |
|
1798 |
if choice == '1':
|
|
|
1821 |
language = default_language
|
1822 |
|
1823 |
# Ask user to change the language
|
1824 |
+
print(f"Do you want to change the language(Character accent) from {default_language}? (y/n): ")
|
1825 |
+
change_lang = input(f"Do you want to change the language(Character accent) from {default_language}? (y/n): ").strip().lower()
|
1826 |
+
if change_lang == "y":
|
1827 |
# List available languages
|
1828 |
languages = ['en', 'es', 'fr', 'de', 'it', 'pt', 'pl', 'tr', 'ru', 'nl', 'cs', 'ar', 'zh-cn', 'hu', 'ko', 'ja', 'hi'] # Extend as needed
|
1829 |
print("Available languages:")
|
|
|
1840 |
print("Invalid selection. Please try again.")
|
1841 |
|
1842 |
# Confirm the selection
|
1843 |
+
print(f"Confirm changing language to {language}? (y/n): ")
|
1844 |
+
confirm = input(f"Confirm changing language to {language}? (y/n): ").strip().lower()
|
1845 |
+
if confirm == "y":
|
1846 |
print(f"Language set to {language}.")
|
1847 |
else:
|
1848 |
print("Language change canceled. Using default English.")
|
|
|
1870 |
select_voices()
|
1871 |
selected_tts_model = select_tts_model()
|
1872 |
#This will ask the user in the terminal if they want to generate all of the audio with only the narrerator's voice
|
1873 |
+
print("Do you want to generate all audio with the Narrator voice? (y/n): ")
|
1874 |
+
use_narrator_voice = input("Do you want to generate all audio with the Narrator voice? (y/n): ").strip().lower()
|
1875 |
+
while use_narrator_voice not in ['y', 'n']:
|
1876 |
+
print("Invalid input. Please type 'y' or 'n'.")
|
1877 |
+
print("Do you want to generate all audio with the Narrator voice? (y/n): ")
|
1878 |
+
use_narrator_voice = input("Do you want to generate all audio with the Narrator voice? (y/n): ").strip().lower()
|
1879 |
+
use_narrator_voice = use_narrator_voice == 'y'
|
1880 |
|
1881 |
global current_language
|
1882 |
current_language = select_language_terminal()
|