Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞Repeated Initialization of pyttsx3 Engine Causes Performance Degradation #370

Open
MudadlaYogitha opened this issue Oct 20, 2024 · 0 comments · May be fixed by #382
Open

🐞Repeated Initialization of pyttsx3 Engine Causes Performance Degradation #370

MudadlaYogitha opened this issue Oct 20, 2024 · 0 comments · May be fixed by #382

Comments

@MudadlaYogitha
Copy link

🐞 Bug Description

In the current implementation, the pyttsx3 text-to-speech engine is initialized inside the speak() function every time it is called. This leads to unnecessary repeated initialization of the engine, which causes performance degradation and introduces noticeable delays in speech output. The bug also results in inefficient resource management, as new engine instances are created repeatedly instead of reusing a single instance.

🔍 Steps to Reproduce

Run the Program:

Execute the provided code that uses pyttsx3 for speech synthesis and speech_recognition for voice input.
Initiate a Conversation:

When prompted by the program, start interacting by answering questions.
Each time the program speaks (via the speak() function), observe the delay between the text prompt and the speech output.
Observe Speech Delays:

Notice the delay in the time it takes for the program to speak after each prompt (e.g., asking "Is it an animal?" or making a guess).

💡 Expected Behavior

Expected Outcome:
Noticeable delays between prompts and speech output.
Increase in memory and CPU usage over time due to repeated engine initialization.

📷 Screenshots

If applicable, add screenshots to help explain your problem.

🖥️ System Information

  • OS: Windows
    Python Version: [e.g., 3.9]
    Library Versions:
    pyttsx3: [e.g., 2.90]
    speech_recognition: [e.g., 3.8.1]

📜 Additional Context

Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants