Espeak NG on Windows & Mac

#12
by dagsvik - opened

I had some trouble getting it up running on windows 11.

I got it working by installing the espeak-ng from the github (1.51 64x.msi version)

And adding this to the python code:

import os

Set the environment variables

os.environ["PHONEMIZER_ESPEAK_LIBRARY"] = r"C:\Program Files\eSpeak NG\libespeak-ng.dll"
os.environ["PHONEMIZER_ESPEAK_PATH"] = r"C:\Program Files\eSpeak NG\espeak-ng.exe"

Verify that they are set

print("PHONEMIZER_ESPEAK_LIBRARY:", os.environ.get("PHONEMIZER_ESPEAK_LIBRARY"))
print("PHONEMIZER_ESPEAK_PATH:", os.environ.get("PHONEMIZER_ESPEAK_PATH"))

Hope it helps if anyone else gets stuck on the same problem.

Thanks, something similar was posted on Discord a couple days ago, but it should also be here for visibility.

I think you can also use EspeakWrapper.set_library, but I do not have access to a Windows machine so I cannot confirm.

For Mac users:

  1. brew install espeak-ng

  2. At the top of kokoro.py (before import phonemizer) put:

from phonemizer.backend.espeak.wrapper import EspeakWrapper
EspeakWrapper.set_library('/opt/homebrew/Cellar/espeak-ng/1.52.0/lib/libespeak-ng.1.dylib')

or whatever the correct path is for your system.

(Anyone can open a PR if you know how to detect & do this automatically for Windows and/or Mac.)

Relevant github issue: https://github.com/bootphon/phonemizer/issues/44#issuecomment-1540885186

hexgrad changed discussion title from Running on windows to Espeak NG on Windows & Mac
hexgrad changed discussion status to closed

Sign up or log in to comment