wannaphong / ttsmms

TTS with The Massively Multilingual Speech (MMS) project
MIT License
222 stars 36 forks source link

basic ssml support. #16

Open willwade opened 1 week ago

willwade commented 1 week ago

So this is the aim


from ttsmms import SSMLEnhancedTTS

# Example SSML text with prosody changes
ssml_text = """
<speak>
    Hello, my friends
    <break time="1000ms"/>
    This is a test.
    <prosody rate="20%" pitch="100%" volume="90%">With prosody changes.</prosody>
</speak>
"""

# Initialize the enhanced TTS model
tts = SSMLEnhancedTTS('/Users/willwade/mms_models/eng')

# Save the synthesized speech with SSML to a WAV file
wav_path_ssml = "example_with_ssml.wav"
tts.synthesis(ssml_text, ssml=True, wav_path=wav_path_ssml)
print(f"Saved synthesized speech with SSML to {wav_path_ssml}")

Its not quite there but it does do something!