vision-agents-plugins-kokoro 0.1.9__py3-none-any.whl → 0.1.11__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.
Potentially problematic release.
This version of vision-agents-plugins-kokoro might be problematic. Click here for more details.
- PKG-INFO +1 -1
- vision_agents/plugins/kokoro/tts.py +9 -24
- {vision_agents_plugins_kokoro-0.1.9.dist-info → vision_agents_plugins_kokoro-0.1.11.dist-info}/METADATA +1 -1
- vision_agents_plugins_kokoro-0.1.11.dist-info/RECORD +9 -0
- vision_agents_plugins_kokoro-0.1.9.dist-info/RECORD +0 -9
- {vision_agents_plugins_kokoro-0.1.9.dist-info → vision_agents_plugins_kokoro-0.1.11.dist-info}/WHEEL +0 -0
PKG-INFO
CHANGED
|
@@ -2,12 +2,12 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import logging
|
|
5
|
+
from typing import AsyncIterator, Iterator, List, Optional
|
|
5
6
|
|
|
6
7
|
import numpy as np
|
|
7
|
-
from typing import AsyncIterator, List, Optional
|
|
8
8
|
|
|
9
9
|
from vision_agents.core import tts
|
|
10
|
-
from
|
|
10
|
+
from vision_agents.core.edge.types import PcmData
|
|
11
11
|
|
|
12
12
|
try:
|
|
13
13
|
from kokoro import KPipeline # type: ignore
|
|
@@ -44,22 +44,9 @@ class TTS(tts.TTS):
|
|
|
44
44
|
self.sample_rate = sample_rate
|
|
45
45
|
self.client = client if client is not None else self._pipeline
|
|
46
46
|
|
|
47
|
-
def
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def get_required_stereo(self) -> bool:
|
|
52
|
-
"""Get whether Kokoro TTS requires stereo audio."""
|
|
53
|
-
return False # Kokoro returns mono audio
|
|
54
|
-
|
|
55
|
-
def set_output_track(self, track: AudioStreamTrack) -> None: # noqa: D401
|
|
56
|
-
if track.framerate != self.sample_rate:
|
|
57
|
-
raise TypeError(
|
|
58
|
-
f"Invalid framerate {track.framerate}, Kokoro requires {self.sample_rate} Hz"
|
|
59
|
-
)
|
|
60
|
-
super().set_output_track(track)
|
|
61
|
-
|
|
62
|
-
async def stream_audio(self, text: str, *_, **__) -> AsyncIterator[bytes]: # noqa: D401
|
|
47
|
+
async def stream_audio(
|
|
48
|
+
self, text: str, *_, **__
|
|
49
|
+
) -> PcmData | Iterator[PcmData] | AsyncIterator[PcmData]: # noqa: D401
|
|
63
50
|
loop = asyncio.get_event_loop()
|
|
64
51
|
chunks: List[bytes] = await loop.run_in_executor(
|
|
65
52
|
None, lambda: list(self._generate_chunks(text))
|
|
@@ -67,7 +54,9 @@ class TTS(tts.TTS):
|
|
|
67
54
|
|
|
68
55
|
async def _aiter():
|
|
69
56
|
for chunk in chunks:
|
|
70
|
-
yield
|
|
57
|
+
yield PcmData.from_bytes(
|
|
58
|
+
chunk, sample_rate=self.sample_rate, channels=1, format="s16"
|
|
59
|
+
)
|
|
71
60
|
|
|
72
61
|
return _aiter()
|
|
73
62
|
|
|
@@ -76,11 +65,7 @@ class TTS(tts.TTS):
|
|
|
76
65
|
Clears the queue and stops playing audio.
|
|
77
66
|
|
|
78
67
|
"""
|
|
79
|
-
|
|
80
|
-
await self.track.flush()
|
|
81
|
-
return
|
|
82
|
-
except Exception as e:
|
|
83
|
-
logging.error(f"Error flushing audio track: {e}")
|
|
68
|
+
logging.info("🎤 Kokoro TTS stop requested (no-op)")
|
|
84
69
|
|
|
85
70
|
def _generate_chunks(self, text: str):
|
|
86
71
|
for _gs, _ps, audio in self._pipeline(
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
./.gitignore,sha256=S6wPCu4rBDB_yyTYoXbMIR-pn4OPv6b3Ulnx1n5RWvo,916
|
|
2
|
+
./PKG-INFO,sha256=Sj4ZR_0Bjr-WJdv9NtnYeA4fSvV1U4mPEBsetYavwxQ,2045
|
|
3
|
+
./README.md,sha256=2olMbGoMYj07OyGlDj_AG2G42o61Tl-Ml4AMINXj4LM,1486
|
|
4
|
+
./pyproject.toml,sha256=tKF8yoc19e21FLXZcomo17LEHGH929kFwX9EIXkRBQA,999
|
|
5
|
+
./vision_agents/plugins/kokoro/__init__.py,sha256=hq4qcv6VHIM24dB_NZEhxogAKD04jX35ngeXhn2M-zQ,158
|
|
6
|
+
./vision_agents/plugins/kokoro/tts.py,sha256=V1mCi_nNXW3_0c79EGBXYcC6ea7y9WwCK7qjyV95MoY,2387
|
|
7
|
+
vision_agents_plugins_kokoro-0.1.11.dist-info/METADATA,sha256=Sj4ZR_0Bjr-WJdv9NtnYeA4fSvV1U4mPEBsetYavwxQ,2045
|
|
8
|
+
vision_agents_plugins_kokoro-0.1.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
9
|
+
vision_agents_plugins_kokoro-0.1.11.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
./.gitignore,sha256=S6wPCu4rBDB_yyTYoXbMIR-pn4OPv6b3Ulnx1n5RWvo,916
|
|
2
|
-
./PKG-INFO,sha256=459Q3UkPTN25M6CwXOwe2YTNA99gh9CeXx8g4G7z6bA,2044
|
|
3
|
-
./README.md,sha256=2olMbGoMYj07OyGlDj_AG2G42o61Tl-Ml4AMINXj4LM,1486
|
|
4
|
-
./pyproject.toml,sha256=tKF8yoc19e21FLXZcomo17LEHGH929kFwX9EIXkRBQA,999
|
|
5
|
-
./vision_agents/plugins/kokoro/__init__.py,sha256=hq4qcv6VHIM24dB_NZEhxogAKD04jX35ngeXhn2M-zQ,158
|
|
6
|
-
./vision_agents/plugins/kokoro/tts.py,sha256=-XjGD0riPnXsCGpVWo9EO42B1a9mV3CmvUVPhqTnyKA,2921
|
|
7
|
-
vision_agents_plugins_kokoro-0.1.9.dist-info/METADATA,sha256=459Q3UkPTN25M6CwXOwe2YTNA99gh9CeXx8g4G7z6bA,2044
|
|
8
|
-
vision_agents_plugins_kokoro-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
9
|
-
vision_agents_plugins_kokoro-0.1.9.dist-info/RECORD,,
|
{vision_agents_plugins_kokoro-0.1.9.dist-info → vision_agents_plugins_kokoro-0.1.11.dist-info}/WHEEL
RENAMED
|
File without changes
|