Spaces:
Sleeping
Sleeping
File size: 735 Bytes
0a88ee7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | from .synth import TinyTTSSynthesizer
class LocalTTSService:
def __init__(self):
self.engine = TinyTTSSynthesizer()
def describe(self) -> str:
return "Local TTS engine ready. No API key and no external model."
def synthesize(
self,
text: str,
voice: str,
speed: float,
pitch_shift: float,
):
sample_rate, audio, normalized = self.engine.synthesize(
text=text,
voice=voice,
speed=float(speed),
pitch_shift=float(pitch_shift),
)
status = f"Generated local speech with voice={voice}, speed={speed:.2f}, pitch_shift={pitch_shift:.2f}"
return (sample_rate, audio), status, normalized
|