6

I'm new to Python. I've been working with gTTS recently and encountered an performance issue. Here is the code:

    from gtts import gTTS
    import pygame
    import time

    tts = gTTS(text='Good morning', lang='en') #<1s
    tts.save('test.mp3') # 30-60s
    pygame.mixer.pre_init()
    pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=512)
    pygame.init()
    player = pygame.mixer.music
    player.load('test.mp3')
    player.play() # <1s
    time.sleep(5)

Im using Python 3.4 on window 7. This performance issue is quite fatal for my project. Any help will be appreciated.

U13-Forward
  • 69,221
  • 14
  • 89
  • 114

0 Answers0