apeatling / ollama-voice-mac

Mac compatible Ollama Voice
GNU Affero General Public License v3.0
430 stars 46 forks source link

TTS is broken on macos #14

Closed UmutAlihan closed 4 months ago

UmutAlihan commented 7 months ago

I am attempting to run but getting this error at the TTS engine with nsss backend:

File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/Users/USER/ollama-voice-mac/venv/lib/python3.12/site-packages/pyttsx3/drivers/nsss.py", line 13, in class NSSpeechDriver(NSObject): File "/Users/USER/ollama-voice-mac/venv/lib/python3.12/site-packages/pyttsx3/drivers/nsss.py", line 81, in NSSpeechDriver @objc.python_method ^^^^ NameError: name 'objc' is not defined. Did you mean: 'object'?

All pip installs are appropriately executed and downloaded whisper models. What can I be missing here?

jboothe commented 7 months ago

I was running into problems with python 3.12. Changing some of the requirement versions and using python 3.9 worked for me.

torch==2.2.2
torchvision==0.17.2
torchaudio==2.2.2
pyttsx3==2.90
blobfile==2.1.1
openai==1.7.0
Wave==0.0.2
PyAudio==0.2.14
PyYAML==6.0.1
pygame==2.5.2
soundfile==0.12.1
pyObjC==9.0.1
openai-whisper @ git+https://github.com/openai/whisper.git@ba3f3cd54b0e5b8ce1ab3de13e32122d0d5f98ab
therealj4nd3rs0n commented 7 months ago

@jboothe thank you for the suggestions, this got me further.

Based on some searching, I tried taking out pyttsx3 and replacing with py3-tts and changed pyObjC from 9.0.1 to 10.2.

Still seeing these errors (full path truncated to protect the guilty):

File "./ollama-voice-mac/lib/python3.12/site-packages/pyttsx3/drivers/nsss.py", line 42, in NSSpeechDriver @objc.python_method ^^^^ NameError: name 'objc' is not defined. Did you mean: 'object'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "./ollama-voice-mac/assistant.py", line 317, in main() File "./ollama-voice-mac/assistant.py", line 291, in main ass = Assistant() ^^^^^^^^^^^ File "./ollama-voice-mac/assistant.py", line 57, in init self.tts = pyttsx3.init("nsss"); ^^^^^^^^^^^^^^^^^^^^ File "./ollama-voice-mac/lib/python3.12/site-packages/pyttsx3/init.py", line 31, in init raise RuntimeError("\n\nUnable to load driver '%s'" % driverName) RuntimeError:

Unable to load driver 'nsss'

I am on MacOS 14.1.1 running on a M2 Pro Mac Mini

therealj4nd3rs0n commented 7 months ago

Follow up comment, further searching got me a little progress, I got past the above error by editing ollama-voice-mac/lib/python3.12/site-packages/pyttsx3/drivers/nsss.py and adding "import objc". The assistant now launches and accepts speech input, which is then sent to ollama correctly. But, TTS is still broken. I see the text output from ollama in my terminal window but no speech audio is generated. I tried upgrading macOS to 14.4.1 to see if it would help, it did not (as expected).