From b2db56adceef42b9a20c8ffb4d49868f630b88a1 Mon Sep 17 00:00:00 2001 From: reubenadams <49562604+reubenadams@users.noreply.github.com> Date: Thu, 22 Aug 2024 22:10:43 +0100 Subject: [PATCH 1/5] Skip mbrola voices from available voices --- phonemizer/backend/espeak/wrapper.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/phonemizer/backend/espeak/wrapper.py b/phonemizer/backend/espeak/wrapper.py index 84a79f5..fa09b97 100644 --- a/phonemizer/backend/espeak/wrapper.py +++ b/phonemizer/backend/espeak/wrapper.py @@ -205,10 +205,11 @@ def available_voices(self, name=None): # voices is an array to pointers, terminated by None while voices[index]: voice = voices[index].contents - available_voices.append(EspeakVoice( - name=os.fsdecode(voice.name).replace('_', ' '), - language=os.fsdecode(voice.languages)[1:], - identifier=os.fsdecode(voice.identifier))) + if not voice.identifier.startswith(b'mb'): + available_voices.append(EspeakVoice( + name=os.fsdecode(voice.name).replace('_', ' '), + language=os.fsdecode(voice.languages)[1:], + identifier=os.fsdecode(voice.identifier))) index += 1 return available_voices From 48dddfd0244c9f86ef0fc7bec68dfe343b70b7a8 Mon Sep 17 00:00:00 2001 From: reubenadams <49562604+reubenadams@users.noreply.github.com> Date: Fri, 23 Aug 2024 21:21:24 +0100 Subject: [PATCH 2/5] Delete original change --- phonemizer/backend/espeak/wrapper.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/phonemizer/backend/espeak/wrapper.py b/phonemizer/backend/espeak/wrapper.py index fa09b97..84a79f5 100644 --- a/phonemizer/backend/espeak/wrapper.py +++ b/phonemizer/backend/espeak/wrapper.py @@ -205,11 +205,10 @@ def available_voices(self, name=None): # voices is an array to pointers, terminated by None while voices[index]: voice = voices[index].contents - if not voice.identifier.startswith(b'mb'): - available_voices.append(EspeakVoice( - name=os.fsdecode(voice.name).replace('_', ' '), - language=os.fsdecode(voice.languages)[1:], - identifier=os.fsdecode(voice.identifier))) + available_voices.append(EspeakVoice( + name=os.fsdecode(voice.name).replace('_', ' '), + language=os.fsdecode(voice.languages)[1:], + identifier=os.fsdecode(voice.identifier))) index += 1 return available_voices From 61e537e7a2f3a24330bad5429220fabd44d32b71 Mon Sep 17 00:00:00 2001 From: reubenadams <49562604+reubenadams@users.noreply.github.com> Date: Fri, 23 Aug 2024 21:27:43 +0100 Subject: [PATCH 3/5] ignore mbrola voices causing a bug on windows (see #146) --- phonemizer/backend/espeak/espeak.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phonemizer/backend/espeak/espeak.py b/phonemizer/backend/espeak/espeak.py index 766af5b..5436c60 100644 --- a/phonemizer/backend/espeak/espeak.py +++ b/phonemizer/backend/espeak/espeak.py @@ -77,7 +77,9 @@ def name(): def supported_languages(cls): return { voice.language: voice.name - for voice in EspeakWrapper().available_voices()} + for voice in EspeakWrapper().available_voices() + # ignore mbrola voices causing a bug on windows (see #146) + if 'mb/' not in voice.identifier} def _phonemize_aux(self, text, offset, separator, strip): if self._tie is not None and separator.phone: From 46111b1eff404e0e9cd9d360d5dc19a2cc6a170a Mon Sep 17 00:00:00 2001 From: reubenadams <49562604+reubenadams@users.noreply.github.com> Date: Fri, 23 Aug 2024 22:13:15 +0100 Subject: [PATCH 4/5] Remove forward slash --- phonemizer/backend/espeak/espeak.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phonemizer/backend/espeak/espeak.py b/phonemizer/backend/espeak/espeak.py index 5436c60..be50266 100644 --- a/phonemizer/backend/espeak/espeak.py +++ b/phonemizer/backend/espeak/espeak.py @@ -79,7 +79,7 @@ def supported_languages(cls): voice.language: voice.name for voice in EspeakWrapper().available_voices() # ignore mbrola voices causing a bug on windows (see #146) - if 'mb/' not in voice.identifier} + if 'mb' not in voice.identifier} def _phonemize_aux(self, text, offset, separator, strip): if self._tie is not None and separator.phone: From bb5d297b83ba628adaa2e473334b859bcf3a276b Mon Sep 17 00:00:00 2001 From: reubenadams <49562604+reubenadams@users.noreply.github.com> Date: Sat, 24 Aug 2024 21:37:00 +0100 Subject: [PATCH 5/5] Remove change to supported_languages method of EspeakBackend --- phonemizer/backend/espeak/espeak.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/phonemizer/backend/espeak/espeak.py b/phonemizer/backend/espeak/espeak.py index be50266..766af5b 100644 --- a/phonemizer/backend/espeak/espeak.py +++ b/phonemizer/backend/espeak/espeak.py @@ -77,9 +77,7 @@ def name(): def supported_languages(cls): return { voice.language: voice.name - for voice in EspeakWrapper().available_voices() - # ignore mbrola voices causing a bug on windows (see #146) - if 'mb' not in voice.identifier} + for voice in EspeakWrapper().available_voices()} def _phonemize_aux(self, text, offset, separator, strip): if self._tie is not None and separator.phone: