pyttsx3 icon indicating copy to clipboard operation
pyttsx3 copied to clipboard

Configuring espeak driver on MacOS

Open Sirorezka opened this issue 3 months ago • 12 comments

Hello, I have installed and configured pyttsx3 on my macOS. And by default it uses nsss as driver and this setting works fine. However when I change the driver to espeak I'm unable to get any sound from the driver.

So by default you should have the following error on macOS:

'libespeak.so.1' (no such file)

To solve it I have installed espeak from the brew and linked it's libraries to the missing file:

  1. I have installed espeak using homewbew formula. I did also check that espeak works
brew install  espeak

espeak "This is a test"  
  1. I have created the symlink libespeak.so.1 to a libespeak.dlyb file. As far as I understood the brew renamed .so.1 to .dlyb.
ln -s  /opt/homebrew/Cellar/espeak/1.48.04_1/lib/libespeak.dylib   libespeak.so.1

Now I don't get errors on missing 'libespeak.so.1', but I unfortunately can't hear any voice during execution:

import pyttsx3

engine = pyttsx3.init('espeak', debug=True)
voices = engine.getProperty('voices')
engine.setProperty('voice',voices[11].id) #English

engine.say('Hello sir, how may I help you, sir.')
engine.runAndWait()

So, am I missing something here? Is this solvable?

Sirorezka avatar Apr 21 '24 22:04 Sirorezka