livekit-plugins-elevenlabs 0.7.4__py3-none-any.whl → 0.7.5__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.
- livekit/plugins/elevenlabs/tts.py +33 -12
- livekit/plugins/elevenlabs/version.py +1 -1
- {livekit_plugins_elevenlabs-0.7.4.dist-info → livekit_plugins_elevenlabs-0.7.5.dist-info}/METADATA +1 -1
- livekit_plugins_elevenlabs-0.7.5.dist-info/RECORD +10 -0
- {livekit_plugins_elevenlabs-0.7.4.dist-info → livekit_plugins_elevenlabs-0.7.5.dist-info}/WHEEL +1 -1
- livekit_plugins_elevenlabs-0.7.4.dist-info/RECORD +0 -10
- {livekit_plugins_elevenlabs-0.7.4.dist-info → livekit_plugins_elevenlabs-0.7.5.dist-info}/top_level.txt +0 -0
@@ -197,17 +197,19 @@ class ChunkedStream(tts.ChunkedStream):
|
|
197
197
|
content = await resp.text()
|
198
198
|
logger.error("11labs returned non-audio data: %s", content)
|
199
199
|
return
|
200
|
+
|
200
201
|
encoding = _encoding_from_format(self._opts.encoding)
|
201
202
|
if encoding == "mp3":
|
202
203
|
async for bytes_data, _ in resp.content.iter_chunks():
|
203
204
|
for frame in self._mp3_decoder.decode_chunk(bytes_data):
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
205
|
+
for frame in bstream.write(frame.data.tobytes()):
|
206
|
+
self._event_ch.send_nowait(
|
207
|
+
tts.SynthesizedAudio(
|
208
|
+
request_id=request_id,
|
209
|
+
segment_id=segment_id,
|
210
|
+
frame=frame,
|
211
|
+
)
|
209
212
|
)
|
210
|
-
)
|
211
213
|
else:
|
212
214
|
async for bytes_data, _ in resp.content.iter_chunks():
|
213
215
|
for frame in bstream.write(bytes_data):
|
@@ -219,12 +221,12 @@ class ChunkedStream(tts.ChunkedStream):
|
|
219
221
|
)
|
220
222
|
)
|
221
223
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
)
|
224
|
+
for frame in bstream.flush():
|
225
|
+
self._event_ch.send_nowait(
|
226
|
+
tts.SynthesizedAudio(
|
227
|
+
request_id=request_id, segment_id=segment_id, frame=frame
|
227
228
|
)
|
229
|
+
)
|
228
230
|
|
229
231
|
|
230
232
|
class SynthesizeStream(tts.SynthesizeStream):
|
@@ -323,15 +325,34 @@ class SynthesizeStream(tts.SynthesizeStream):
|
|
323
325
|
async def send_task():
|
324
326
|
nonlocal eos_sent
|
325
327
|
|
328
|
+
xml_content = []
|
326
329
|
async for data in word_stream:
|
330
|
+
text = data.token
|
331
|
+
|
332
|
+
# send the xml phoneme in one go
|
333
|
+
if (
|
334
|
+
self._opts.enable_ssml_parsing
|
335
|
+
and data.token.startswith("<phoneme")
|
336
|
+
or xml_content
|
337
|
+
):
|
338
|
+
xml_content.append(text)
|
339
|
+
if data.token.find("</phoneme>") > -1:
|
340
|
+
text = self._opts.word_tokenizer.format_words(xml_content)
|
341
|
+
xml_content = []
|
342
|
+
else:
|
343
|
+
continue
|
344
|
+
|
327
345
|
# try_trigger_generation=True is a bad practice, we expose
|
328
346
|
# chunk_length_schedule instead
|
329
347
|
data_pkt = dict(
|
330
|
-
text=f"{
|
348
|
+
text=f"{text} ", # must always end with a space
|
331
349
|
try_trigger_generation=False,
|
332
350
|
)
|
333
351
|
await ws_conn.send_str(json.dumps(data_pkt))
|
334
352
|
|
353
|
+
if xml_content:
|
354
|
+
logger.warning("11labs stream ended with incomplete xml content")
|
355
|
+
|
335
356
|
# no more token, mark eos
|
336
357
|
eos_pkt = dict(text="")
|
337
358
|
await ws_conn.send_str(json.dumps(eos_pkt))
|
@@ -0,0 +1,10 @@
|
|
1
|
+
livekit/plugins/elevenlabs/__init__.py,sha256=cYRVIPXkRvB3-jK9bKZ9rYiMBACytWlCSq6yoZXaSgA,1080
|
2
|
+
livekit/plugins/elevenlabs/log.py,sha256=hIuXqDsEB5GBa7rQY3z4Uqi1oCqc_lRmCHZEmXz0LHw,73
|
3
|
+
livekit/plugins/elevenlabs/models.py,sha256=ddBUlDT4707f64WDJASR0B60X0yQ-LRHK1ZpTuBJXK8,387
|
4
|
+
livekit/plugins/elevenlabs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
livekit/plugins/elevenlabs/tts.py,sha256=L9d4KppfqP9tP-PvaE3YKbezovhSboejmIk97xOmdEA,15868
|
6
|
+
livekit/plugins/elevenlabs/version.py,sha256=4VoyPg1xoLZO0SP38sbtfe-ePEx82VqZVWRBBUr1wgA,600
|
7
|
+
livekit_plugins_elevenlabs-0.7.5.dist-info/METADATA,sha256=KMqAU3UsRzO4wFl-Y8GfT5-Bb7s_bnm8JmuETbQ2cJo,1311
|
8
|
+
livekit_plugins_elevenlabs-0.7.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
9
|
+
livekit_plugins_elevenlabs-0.7.5.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
|
10
|
+
livekit_plugins_elevenlabs-0.7.5.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
livekit/plugins/elevenlabs/__init__.py,sha256=cYRVIPXkRvB3-jK9bKZ9rYiMBACytWlCSq6yoZXaSgA,1080
|
2
|
-
livekit/plugins/elevenlabs/log.py,sha256=hIuXqDsEB5GBa7rQY3z4Uqi1oCqc_lRmCHZEmXz0LHw,73
|
3
|
-
livekit/plugins/elevenlabs/models.py,sha256=ddBUlDT4707f64WDJASR0B60X0yQ-LRHK1ZpTuBJXK8,387
|
4
|
-
livekit/plugins/elevenlabs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
livekit/plugins/elevenlabs/tts.py,sha256=D0NXdOU94vFkYznWkx-tDRi8eBBSj-uMtv-E6s4abds,15099
|
6
|
-
livekit/plugins/elevenlabs/version.py,sha256=UblqPqnLJ1iqLGElaqb_uNunR14phGN2btPpCGRFrYk,600
|
7
|
-
livekit_plugins_elevenlabs-0.7.4.dist-info/METADATA,sha256=v69Po6l03UZl89vzcNhM3Wd2yezLTHjcN1q5I-sbfgg,1311
|
8
|
-
livekit_plugins_elevenlabs-0.7.4.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
|
9
|
-
livekit_plugins_elevenlabs-0.7.4.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
|
10
|
-
livekit_plugins_elevenlabs-0.7.4.dist-info/RECORD,,
|
File without changes
|