Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -69,23 +69,22 @@ async def edge_tts_engine(text, voice, rate, pitch):
|
|
| 69 |
# -----------------------------
|
| 70 |
|
| 71 |
def piper_engine_wrapper(text, rate, pitch):
|
| 72 |
-
|
| 73 |
if not text.strip():
|
| 74 |
return None, "Please enter text."
|
| 75 |
|
| 76 |
-
#
|
| 77 |
speed = 1.0 + rate / 100
|
| 78 |
pitch_scale = 1.0 + pitch / 50
|
| 79 |
|
|
|
|
| 80 |
audio = piper_engine.synthesize(
|
| 81 |
text=text,
|
| 82 |
speed=speed,
|
| 83 |
-
pitch=pitch_scale
|
| 84 |
)
|
| 85 |
|
| 86 |
return audio, None
|
| 87 |
-
|
| 88 |
-
|
| 89 |
# -----------------------------
|
| 90 |
# Unified Interface
|
| 91 |
# -----------------------------
|
|
|
|
| 69 |
# -----------------------------
|
| 70 |
|
| 71 |
def piper_engine_wrapper(text, rate, pitch):
|
|
|
|
| 72 |
if not text.strip():
|
| 73 |
return None, "Please enter text."
|
| 74 |
|
| 75 |
+
# Map sliders to speed / pitch
|
| 76 |
speed = 1.0 + rate / 100
|
| 77 |
pitch_scale = 1.0 + pitch / 50
|
| 78 |
|
| 79 |
+
# Call PiperEngine
|
| 80 |
audio = piper_engine.synthesize(
|
| 81 |
text=text,
|
| 82 |
speed=speed,
|
| 83 |
+
pitch=pitch_scale
|
| 84 |
)
|
| 85 |
|
| 86 |
return audio, None
|
| 87 |
+
|
|
|
|
| 88 |
# -----------------------------
|
| 89 |
# Unified Interface
|
| 90 |
# -----------------------------
|