wyoming-piper 1.4.0__py3-none-any.whl → 1.5.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wyoming_piper/__init__.py +5 -0
- wyoming_piper/__main__.py +30 -11
- wyoming_piper/handler.py +10 -0
- wyoming_piper/voices.json +1420 -6
- wyoming_piper-1.5.3.dist-info/METADATA +73 -0
- wyoming_piper-1.5.3.dist-info/RECORD +14 -0
- {wyoming_piper-1.4.0.dist-info → wyoming_piper-1.5.3.dist-info}/WHEEL +1 -1
- wyoming_piper-1.5.3.dist-info/entry_points.txt +2 -0
- wyoming_piper-1.4.0.dist-info/METADATA +0 -21
- wyoming_piper-1.4.0.dist-info/RECORD +0 -13
- {wyoming_piper-1.4.0.dist-info → wyoming_piper-1.5.3.dist-info/licenses}/LICENSE.md +0 -0
- {wyoming_piper-1.4.0.dist-info → wyoming_piper-1.5.3.dist-info}/top_level.txt +0 -0
wyoming_piper/__init__.py
CHANGED
wyoming_piper/__main__.py
CHANGED
|
@@ -7,9 +7,10 @@ from functools import partial
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import Any, Dict, Set
|
|
9
9
|
|
|
10
|
-
from wyoming.info import Attribution, Info, TtsProgram, TtsVoice
|
|
10
|
+
from wyoming.info import Attribution, Info, TtsProgram, TtsVoice, TtsVoiceSpeaker
|
|
11
11
|
from wyoming.server import AsyncServer
|
|
12
12
|
|
|
13
|
+
from . import __version__
|
|
13
14
|
from .download import find_voice, get_voices
|
|
14
15
|
from .handler import PiperEventHandler
|
|
15
16
|
from .process import PiperProcessManager
|
|
@@ -67,13 +68,25 @@ async def main() -> None:
|
|
|
67
68
|
)
|
|
68
69
|
#
|
|
69
70
|
parser.add_argument("--debug", action="store_true", help="Log DEBUG messages")
|
|
71
|
+
parser.add_argument(
|
|
72
|
+
"--log-format", default=logging.BASIC_FORMAT, help="Format for log messages"
|
|
73
|
+
)
|
|
74
|
+
parser.add_argument(
|
|
75
|
+
"--version",
|
|
76
|
+
action="version",
|
|
77
|
+
version=__version__,
|
|
78
|
+
help="Print version and exit",
|
|
79
|
+
)
|
|
70
80
|
args = parser.parse_args()
|
|
71
81
|
|
|
72
82
|
if not args.download_dir:
|
|
73
83
|
# Default to first data directory
|
|
74
84
|
args.download_dir = args.data_dir[0]
|
|
75
85
|
|
|
76
|
-
logging.basicConfig(
|
|
86
|
+
logging.basicConfig(
|
|
87
|
+
level=logging.DEBUG if args.debug else logging.INFO, format=args.log_format
|
|
88
|
+
)
|
|
89
|
+
_LOGGER.debug(args)
|
|
77
90
|
|
|
78
91
|
# Load voice info
|
|
79
92
|
voices_info = get_voices(args.download_dir, update_voices=args.update_voices)
|
|
@@ -93,20 +106,19 @@ async def main() -> None:
|
|
|
93
106
|
name="rhasspy", url="https://github.com/rhasspy/piper"
|
|
94
107
|
),
|
|
95
108
|
installed=True,
|
|
109
|
+
version=None,
|
|
96
110
|
languages=[
|
|
97
111
|
voice_info.get("language", {}).get(
|
|
98
112
|
"code",
|
|
99
113
|
voice_info.get("espeak", {}).get("voice", voice_name.split("_")[0]),
|
|
100
114
|
)
|
|
101
115
|
],
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
# if voice_info.get("speaker_id_map")
|
|
109
|
-
# else None,
|
|
116
|
+
speakers=[
|
|
117
|
+
TtsVoiceSpeaker(name=speaker_name)
|
|
118
|
+
for speaker_name in voice_info["speaker_id_map"]
|
|
119
|
+
]
|
|
120
|
+
if voice_info.get("speaker_id_map")
|
|
121
|
+
else None,
|
|
110
122
|
)
|
|
111
123
|
for voice_name, voice_info in voices_info.items()
|
|
112
124
|
if not voice_info.get("_is_alias", False)
|
|
@@ -150,6 +162,7 @@ async def main() -> None:
|
|
|
150
162
|
TtsVoice(
|
|
151
163
|
name=custom_name,
|
|
152
164
|
description=description,
|
|
165
|
+
version=None,
|
|
153
166
|
attribution=Attribution(name="", url=""),
|
|
154
167
|
installed=True,
|
|
155
168
|
languages=[lang_code],
|
|
@@ -166,6 +179,7 @@ async def main() -> None:
|
|
|
166
179
|
),
|
|
167
180
|
installed=True,
|
|
168
181
|
voices=sorted(voices, key=lambda v: v.name),
|
|
182
|
+
version=__version__,
|
|
169
183
|
)
|
|
170
184
|
],
|
|
171
185
|
)
|
|
@@ -204,8 +218,13 @@ def get_description(voice_info: Dict[str, Any]):
|
|
|
204
218
|
|
|
205
219
|
# -----------------------------------------------------------------------------
|
|
206
220
|
|
|
221
|
+
|
|
222
|
+
def run():
|
|
223
|
+
asyncio.run(main())
|
|
224
|
+
|
|
225
|
+
|
|
207
226
|
if __name__ == "__main__":
|
|
208
227
|
try:
|
|
209
|
-
|
|
228
|
+
run()
|
|
210
229
|
except KeyboardInterrupt:
|
|
211
230
|
pass
|
wyoming_piper/handler.py
CHANGED
|
@@ -8,6 +8,7 @@ import wave
|
|
|
8
8
|
from typing import Any, Dict, Optional
|
|
9
9
|
|
|
10
10
|
from wyoming.audio import AudioChunk, AudioStart, AudioStop
|
|
11
|
+
from wyoming.error import Error
|
|
11
12
|
from wyoming.event import Event
|
|
12
13
|
from wyoming.info import Describe, Info
|
|
13
14
|
from wyoming.server import AsyncEventHandler
|
|
@@ -43,6 +44,15 @@ class PiperEventHandler(AsyncEventHandler):
|
|
|
43
44
|
_LOGGER.warning("Unexpected event: %s", event)
|
|
44
45
|
return True
|
|
45
46
|
|
|
47
|
+
try:
|
|
48
|
+
return await self._handle_event(event)
|
|
49
|
+
except Exception as err:
|
|
50
|
+
await self.write_event(
|
|
51
|
+
Error(text=str(err), code=err.__class__.__name__).event()
|
|
52
|
+
)
|
|
53
|
+
raise err
|
|
54
|
+
|
|
55
|
+
async def _handle_event(self, event: Event) -> bool:
|
|
46
56
|
synthesize = Synthesize.from_event(event)
|
|
47
57
|
_LOGGER.debug(synthesize)
|
|
48
58
|
|