livekit-plugins-neuphonic 0.1.1__py3-none-any.whl → 0.1.2__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/neuphonic/tts.py +7 -29
- livekit/plugins/neuphonic/version.py +1 -1
- {livekit_plugins_neuphonic-0.1.1.dist-info → livekit_plugins_neuphonic-0.1.2.dist-info}/METADATA +3 -3
- livekit_plugins_neuphonic-0.1.2.dist-info/RECORD +10 -0
- {livekit_plugins_neuphonic-0.1.1.dist-info → livekit_plugins_neuphonic-0.1.2.dist-info}/WHEEL +1 -1
- livekit_plugins_neuphonic-0.1.1.dist-info/RECORD +0 -10
- {livekit_plugins_neuphonic-0.1.1.dist-info → livekit_plugins_neuphonic-0.1.2.dist-info}/top_level.txt +0 -0
livekit/plugins/neuphonic/tts.py
CHANGED
@@ -348,26 +348,6 @@ class SynthesizeStream(tts.SynthesizeStream):
|
|
348
348
|
|
349
349
|
async def _run(self) -> None:
|
350
350
|
request_id = utils.shortuuid()
|
351
|
-
request_data = {request_id: {"sent": "", "recv": ""}}
|
352
|
-
|
353
|
-
def _is_all_audio_recv():
|
354
|
-
"""Check whether all audio has been recieved."""
|
355
|
-
recv_text = (
|
356
|
-
request_data[request_id]["recv"]
|
357
|
-
.lower()
|
358
|
-
.replace(" ", "")
|
359
|
-
.replace("\n", "")
|
360
|
-
.replace("<stop>", "")
|
361
|
-
)
|
362
|
-
sent_text = (
|
363
|
-
request_data[request_id]["sent"]
|
364
|
-
.lower()
|
365
|
-
.replace(" ", "")
|
366
|
-
.replace("\n", "")
|
367
|
-
.replace("<stop>", "")
|
368
|
-
)
|
369
|
-
|
370
|
-
return sent_text == recv_text
|
371
351
|
|
372
352
|
async def _send_task(ws: aiohttp.ClientWebSocketResponse):
|
373
353
|
"""Stream text to the websocket."""
|
@@ -378,7 +358,6 @@ class SynthesizeStream(tts.SynthesizeStream):
|
|
378
358
|
await ws.send_str(json.dumps({"text": "<STOP>"}))
|
379
359
|
continue
|
380
360
|
|
381
|
-
request_data[request_id]["sent"] += data
|
382
361
|
await ws.send_str(json.dumps({"text": data}))
|
383
362
|
|
384
363
|
async def _recv_task(ws: aiohttp.ClientWebSocketResponse):
|
@@ -411,20 +390,19 @@ class SynthesizeStream(tts.SynthesizeStream):
|
|
411
390
|
|
412
391
|
if data.get("data"):
|
413
392
|
b64data = base64.b64decode(data["data"]["audio"])
|
414
|
-
recv_text = data["data"]["text"]
|
415
393
|
for frame in audio_bstream.write(b64data):
|
416
394
|
emitter.push(frame)
|
417
395
|
|
418
|
-
|
396
|
+
if data["data"].get(
|
397
|
+
"stop"
|
398
|
+
): # A bool flag, is True when audio reaches "<STOP>"
|
399
|
+
for frame in audio_bstream.flush():
|
400
|
+
emitter.push(frame)
|
401
|
+
emitter.flush()
|
402
|
+
break # we are not going to receive any more audio
|
419
403
|
else:
|
420
404
|
logger.error("Unexpected Neuphonic message %s", data)
|
421
405
|
|
422
|
-
if _is_all_audio_recv():
|
423
|
-
for frame in audio_bstream.flush():
|
424
|
-
emitter.push(frame)
|
425
|
-
emitter.flush()
|
426
|
-
break # we are not going to receive any more audio
|
427
|
-
|
428
406
|
async with self._pool.connection() as ws:
|
429
407
|
tasks = [
|
430
408
|
asyncio.create_task(_send_task(ws)),
|
{livekit_plugins_neuphonic-0.1.1.dist-info → livekit_plugins_neuphonic-0.1.2.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: livekit-plugins-neuphonic
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.2
|
4
4
|
Summary: LiveKit Agents Plugin for Neuphonic
|
5
5
|
Home-page: https://github.com/livekit/agents
|
6
6
|
License: Apache-2.0
|
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
19
19
|
Classifier: Programming Language :: Python :: 3 :: Only
|
20
20
|
Requires-Python: >=3.9.0
|
21
21
|
Description-Content-Type: text/markdown
|
22
|
-
Requires-Dist: livekit-agents<1.0.0,>=0.12.
|
22
|
+
Requires-Dist: livekit-agents<1.0.0,>=0.12.20
|
23
23
|
Dynamic: classifier
|
24
24
|
Dynamic: description
|
25
25
|
Dynamic: description-content-type
|
@@ -0,0 +1,10 @@
|
|
1
|
+
livekit/plugins/neuphonic/__init__.py,sha256=mJnPVLsKAdUkdWuHWd16A0n2vsVBi3GjgNmB8gv9jjI,1097
|
2
|
+
livekit/plugins/neuphonic/log.py,sha256=rAHz71IcbvPkixndXBVffPQsmWUKTLqRaYRuPIxO29w,72
|
3
|
+
livekit/plugins/neuphonic/models.py,sha256=Svfn_sWA3Q2ZXsPBXY-K5hslq5FE62hvyXBES2C3aSc,201
|
4
|
+
livekit/plugins/neuphonic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
livekit/plugins/neuphonic/tts.py,sha256=NvFgIgig9sNAUS5qBFQq3PHBX-RoSgt_HF01okVOmss,14137
|
6
|
+
livekit/plugins/neuphonic/version.py,sha256=S3xxF-H96nScSv_7l7IUvROJ0avu9oz5Gm6j673md_Y,600
|
7
|
+
livekit_plugins_neuphonic-0.1.2.dist-info/METADATA,sha256=oSAGd-KZUiL3Ks4-s1p8-CbL8HdGcIA5pGMLZFCPvXg,1478
|
8
|
+
livekit_plugins_neuphonic-0.1.2.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
9
|
+
livekit_plugins_neuphonic-0.1.2.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
|
10
|
+
livekit_plugins_neuphonic-0.1.2.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
livekit/plugins/neuphonic/__init__.py,sha256=mJnPVLsKAdUkdWuHWd16A0n2vsVBi3GjgNmB8gv9jjI,1097
|
2
|
-
livekit/plugins/neuphonic/log.py,sha256=rAHz71IcbvPkixndXBVffPQsmWUKTLqRaYRuPIxO29w,72
|
3
|
-
livekit/plugins/neuphonic/models.py,sha256=Svfn_sWA3Q2ZXsPBXY-K5hslq5FE62hvyXBES2C3aSc,201
|
4
|
-
livekit/plugins/neuphonic/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
livekit/plugins/neuphonic/tts.py,sha256=VvAQ7-fja3TzfM0POyk1LyPXSZbXnyiE7_-Bsd98qEk,14837
|
6
|
-
livekit/plugins/neuphonic/version.py,sha256=3-nEcobvIJfZdV4yNIRuYpAGQ3svREnYIv2ivxoIZcQ,600
|
7
|
-
livekit_plugins_neuphonic-0.1.1.dist-info/METADATA,sha256=0_fdr8DXqhh5HJ47byiBfuB3Qrjz3jJo-i8URkpeTtY,1478
|
8
|
-
livekit_plugins_neuphonic-0.1.1.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
9
|
-
livekit_plugins_neuphonic-0.1.1.dist-info/top_level.txt,sha256=OoDok3xUmXbZRvOrfvvXB-Juu4DX79dlq188E19YHoo,8
|
10
|
-
livekit_plugins_neuphonic-0.1.1.dist-info/RECORD,,
|
File without changes
|