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

Added functionality for using pyttsx3 instead of coqui-ai TTS #33

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

soleyhyman
Copy link

This pull request adds additional text-to-speech functionality in case users are unable to install the Coqui-AI TTS package. The proposed code uses the pyttsx3 package. In it's essence, the added code checks whether the Coqui-AI TTS package can be imported. If it can, the code proceeds as usual (with the new ttsMode variable set to 'coqui-TTS'). Otherwise, it tries to import pyttsx3 and set the ttsMode variable to 'pyttsx3'.

@james-trayford
Copy link
Owner

Thanks @soleyhyman - I've updated dev to main to show just your commits. Will take a look at the changes

@james-trayford james-trayford self-assigned this Nov 1, 2024
…st-time run, but leaves the tts engine in an abortive state
Copy link
Owner

@james-trayford james-trayford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for your work! I had a few issues with pyttsx3 on my system, but with some tweaks it's almost there I think. see here: soleyhyman#1 - I'd like to look into this a but more

Comment on lines 124 to 125
else:
TTS()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can move this to L116 in order to work correctly for no tts modules case

try:
import pyttsx3
ttsMode = 'pyttsx3'
print('pyttsx3 has been successfully imported.')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can comment out these prints for now - we want to implement logging / debug text at some point but generally trying to keep quiet unless needed

print('Rendering caption (this can take a while if the caption is long)...')

# capture stdout from the talkative TTS module
with utils.Capturing() as output:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like pttsx3 is quiet - so perhaps don't need the capturing environment in this case

@james-trayford
Copy link
Owner

@soleyhyman looks like a fix for nateshmbhat/pyttsx3#384 was pushed (willwade/pyttsx3@4d90b3f) - could try this with

pip install --upgrade --force-reinstall git+https://github.com/nateshmbhat/pyttsx3.git@4d90b3fcf8709ebc34ee0b157c408f00b6154e47

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

Successfully merging this pull request may close these issues.

3 participants