Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,25 @@ def load_model() -> bool:

# Auto-configure eSpeak for Linux by finding the system-installed library
elif os.name == "posix": # Linux/macOS
logger.info("Checking for system-installed eSpeak NG on Linux...")
logger.info("Checking for system-installed eSpeak NG on Linux/Mac...")
# By setting the library path, we let phonemizer handle finding the data path, which is more robust.
espeak_lib_path = "/usr/lib/x86_64-linux-gnu/libespeak-ng.so"
if Path(espeak_lib_path).exists():
os.environ["PHONEMIZER_ESPEAK_LIBRARY"] = espeak_lib_path
possible_paths = [
Path("/usr/lib/x86_64-linux-gnu/libespeak-ng.so"),
Path("/opt/homebrew/lib/libespeak-ng.dylib"),
]
espeak_found = False
for espeak_lib_path in possible_paths:
if not espeak_lib_path.exists():
continue
os.environ["PHONEMIZER_ESPEAK_LIBRARY"] = str(espeak_lib_path)
logger.info(
f"Found and configured system eSpeak NG library: {espeak_lib_path}"
)
else:
espeak_found = True
break
if not espeak_found:
logger.warning(
f"Could not find system eSpeak NG library at {espeak_lib_path}. "
f"Could not find system eSpeak NG library at {possible_paths}. "
"Please ensure 'espeak-ng' is installed via your package manager."
)

Expand Down