Update voice_processing.py
Browse files- voice_processing.py +3 -9
voice_processing.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import asyncio
|
2 |
import datetime
|
3 |
import logging
|
4 |
import os
|
@@ -34,7 +33,7 @@ limitation = os.getenv("SYSTEM") == "spaces"
|
|
34 |
config = Config()
|
35 |
|
36 |
# Edge TTS
|
37 |
-
tts_voice_list =
|
38 |
tts_voices = ["mn-MN-BataaNeural", "mn-MN-YesuiNeural"] # Specific voices
|
39 |
|
40 |
# RVC models
|
@@ -45,10 +44,6 @@ models.sort()
|
|
45 |
def get_unique_filename(extension):
|
46 |
return f"{uuid.uuid4()}.{extension}"
|
47 |
|
48 |
-
|
49 |
-
#edge_output_filename = get_unique_filename("mp3")
|
50 |
-
|
51 |
-
|
52 |
def model_data(model_name):
|
53 |
# global n_spk, tgt_sr, net_g, vc, cpt, version, index_file
|
54 |
pth_path = [
|
@@ -118,7 +113,7 @@ def get_model_names():
|
|
118 |
model_root = "weights" # Assuming this is where your models are stored
|
119 |
return [d for d in os.listdir(model_root) if os.path.isdir(f"{model_root}/{d}")]
|
120 |
|
121 |
-
|
122 |
model_name,
|
123 |
tts_text,
|
124 |
tts_voice,
|
@@ -163,7 +158,7 @@ async def tts(
|
|
163 |
# Invoke Edge TTS
|
164 |
t0 = time.time()
|
165 |
speed_str = f"+{speed}%" if speed >= 0 else f"{speed}%"
|
166 |
-
|
167 |
tts_text, tts_voice, rate=speed_str
|
168 |
).save(edge_output_filename)
|
169 |
t1 = time.time()
|
@@ -245,4 +240,3 @@ voice_mapping = {
|
|
245 |
hubert_model = load_hubert()
|
246 |
|
247 |
rmvpe_model = RMVPE("rmvpe.pt", config.is_half, config.device)
|
248 |
-
|
|
|
|
|
1 |
import datetime
|
2 |
import logging
|
3 |
import os
|
|
|
33 |
config = Config()
|
34 |
|
35 |
# Edge TTS
|
36 |
+
tts_voice_list = edge_tts.list_voices()
|
37 |
tts_voices = ["mn-MN-BataaNeural", "mn-MN-YesuiNeural"] # Specific voices
|
38 |
|
39 |
# RVC models
|
|
|
44 |
def get_unique_filename(extension):
|
45 |
return f"{uuid.uuid4()}.{extension}"
|
46 |
|
|
|
|
|
|
|
|
|
47 |
def model_data(model_name):
|
48 |
# global n_spk, tgt_sr, net_g, vc, cpt, version, index_file
|
49 |
pth_path = [
|
|
|
113 |
model_root = "weights" # Assuming this is where your models are stored
|
114 |
return [d for d in os.listdir(model_root) if os.path.isdir(f"{model_root}/{d}")]
|
115 |
|
116 |
+
def tts(
|
117 |
model_name,
|
118 |
tts_text,
|
119 |
tts_voice,
|
|
|
158 |
# Invoke Edge TTS
|
159 |
t0 = time.time()
|
160 |
speed_str = f"+{speed}%" if speed >= 0 else f"{speed}%"
|
161 |
+
edge_tts.Communicate(
|
162 |
tts_text, tts_voice, rate=speed_str
|
163 |
).save(edge_output_filename)
|
164 |
t1 = time.time()
|
|
|
240 |
hubert_model = load_hubert()
|
241 |
|
242 |
rmvpe_model = RMVPE("rmvpe.pt", config.is_half, config.device)
|
|