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

replicating a PR from upstream code #2

Closed
wants to merge 0 commits into from

Conversation

willwade
Copy link

@willwade willwade commented May 3, 2024

nateshmbhat/pyttsx3#186

I've literally copy and pasted here - but works well for me :)

@dormant-user
Copy link
Member

@willwade Thanks for the PR, I'm not sure what problem this is addressing. I run py3-tts on macOS, Windows and Linux
All 3 runs clean, can you narrow down the problem for me.

@dormant-user dormant-user added question Further information is requested and removed question Further information is requested labels May 21, 2024
@willwade
Copy link
Author

It’s the on word event handling. It’s broken. But this fixes it

eg. From the docs

import pyttsx3
def onStart(name):
    print 'starting', name
def onWord(name, location, length):
    print 'word', name, location, length
def onEnd(name, completed):
    print 'finishing', name, completed
engine = pyttsx3.init()
engine.connect('started-utterance', onStart)
engine.connect('started-word', onWord)
engine.connect('finished-utterance', onEnd)
engine.say('The quick brown fox jumped over the lazy dog.', 'fox')
engine.runAndWait()

it was broken in sapi and working in Mac. This fixes the sapi problem. There are a couple of PRs attempting this in the original code. But this is the simplest and works. There is another one but it drifts from fixing other aspects.

pyttsx3/drivers/sapi5.py Outdated Show resolved Hide resolved
pyttsx3/drivers/sapi5.py Outdated Show resolved Hide resolved
pyttsx3/drivers/nsss.py Outdated Show resolved Hide resolved
pyttsx3/drivers/_espeak.py Outdated Show resolved Hide resolved
@dormant-user
Copy link
Member

@willwade Thanks for the update. I've approved the changes after looking up related discussions/PRs and docs
I'll merge it once I have these changes tested
Btw, which OS is this driver causing an issue?
pyttsx3 originally used sapi5 only for Windows, however it's the _espeak module that is updated, and the function says load_macos_espeak, so I'm a bit lost here

@willwade
Copy link
Author

Oh sorry. That's me trying to solve a second problem. That espeak is broken on macOS. It doesn't find the correct .so file but it turns out even if it finds it that library is not working on macOS. Infact it's broken on windows too. There's quite a few issues discussing this nateshmbhat/pyttsx3#311

Still my change does at least link to the right so file when it does work. (Nb I'm working on that in espeak)

pyttsx3/drivers/sapi5.py Outdated Show resolved Hide resolved
pyttsx3/drivers/_espeak.py Outdated Show resolved Hide resolved
@nachoal
Copy link

nachoal commented May 23, 2024

Hey @willwade where you able to fix the issue of mac not being able to play any sound? I was able to make espeak-ng from my M3 mac and fix the file issues with:

  • export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
  • export ESPEAK_DATA_PATH=/usr/local/share/espeak-ng-data

but now when I run espeak 'text' it doesn't work, looking at the stdout it seems to be corrupted:

espeak-ng 'hello world' --stdout
|x=3�@` �nEAe!za^(�q�D�	10�Q	z}n�@Yow@�UUV�|vw~�&Nu� 5CKSXb_ZRMA5)#���������������"$	
�W<A�/q�+L1BLF^>B.�x���"N1�,l��x�P>�Q�#���                                              E7cWLL[0#���.L��	�)
                                          ,as�,g�mgL �a*Vc�ZqmY���0_-6+���>Y�	���Q����1��Q��'�IU0�33�
                                                                                                       QaT/yh\�R*�HZ�ijB^��(N%�Vd�z�W0��GV>�B6`9I0L0�S�a����hv
rOL�a�A�����w�g/M�l���P�Xli.K����j�h�yo>Q?�os{�o	S3�&zT�G;}^j�ye�0!@"s5vO_��a�p4�;
                    Sq���NyY���9�@
(�;T<�(%
       F����Y#�2�(-f{l����IX<l`�Z�,H�11�FVI�#17~��<�X��T7�e��x]
'�X��>7
DJ�_z	�13&@
             yx25DQ�tAw=�,-��|����)J�L	'�u�G%d2/P #!�!L$���-Rg*uGres<����X4�)U�fIh$$�&a��	�cc��J##A������

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