Spaces:
Sleeping
Sleeping
| 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 | |