Skip to content

Commit

Permalink
last logging to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
willwade committed Nov 15, 2024
1 parent 0caa777 commit 8aadd82
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyttsx3/drivers/espeak.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class EspeakDriver:
_defaultVoice = ""

def __init__(self, proxy):

if not EspeakDriver._moduleInitialized:
# espeak cannot initialize more than once per process and has
# issues when terminating from python (assert error on close)
Expand Down Expand Up @@ -125,10 +126,10 @@ def setProperty(name: str, value):
return
try:
utf8Value = str(value).encode("utf-8")
logging.debug(f"Attempting to set voice to: {value}")
logger.debug(f"Attempting to set voice to: {value}")
result = _espeak.SetVoiceByName(utf8Value)
if result == 0: # EE_OK is 0
logging.debug(f"Successfully set voice to: {value}")
logger.debug(f"Successfully set voice to: {value}")
elif result == 1: # EE_BUFFER_FULL
raise ValueError(
f"SetVoiceByName failed: EE_BUFFER_FULL while setting voice to {value}"
Expand Down Expand Up @@ -211,6 +212,7 @@ def _onSynth(self, wav, numsamples, events):
# Handle utterance completion
if self._save_file:
# Save audio to file if requested
print('Saving to file')
try:
with wave.open(self._save_file, "wb") as f:
f.setnchannels(1) # Mono
Expand Down

0 comments on commit 8aadd82

Please sign in to comment.