KoljaB / RealtimeTTS

Converts text to speech in realtime
1.39k stars 119 forks source link

Is there any way to change the speech speed? #84

Open Santabot123 opened 1 month ago

Santabot123 commented 1 month ago

Previously I used gtts in my project and in order to speed up the sound I wrote this code:

from gtts import gTTS
from pydub import AudioSegment
from pydub.playback import play

def speak(my_text):
     with io.BytesIO() as f:
         gTTS(text=my_text, lang=LANGUAGE).write_to_fp(f)
         f.seek(0)

         sound = AudioSegment.from_file(io.BytesIO(f.read()))
         sound = sound.speedup(1.0+(SPEED_UP/100), 150, 25)
         play(sound)

But my code didn't provide real-time voice generation. Then I saw this repository, and now I'm wondering if it's possible to do something similar with GTTSEngine()

KoljaB commented 1 month ago

Not yet. I can add that in the next version.