videosdk-plugins-resemble 0.0.19__tar.gz → 0.0.21__tar.gz
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 videosdk-plugins-resemble might be problematic. Click here for more details.
- {videosdk_plugins_resemble-0.0.19 → videosdk_plugins_resemble-0.0.21}/PKG-INFO +2 -2
- {videosdk_plugins_resemble-0.0.19 → videosdk_plugins_resemble-0.0.21}/pyproject.toml +1 -1
- {videosdk_plugins_resemble-0.0.19 → videosdk_plugins_resemble-0.0.21}/videosdk/plugins/resemble/tts.py +23 -7
- videosdk_plugins_resemble-0.0.21/videosdk/plugins/resemble/version.py +1 -0
- videosdk_plugins_resemble-0.0.19/videosdk/plugins/resemble/version.py +0 -1
- {videosdk_plugins_resemble-0.0.19 → videosdk_plugins_resemble-0.0.21}/.gitignore +0 -0
- {videosdk_plugins_resemble-0.0.19 → videosdk_plugins_resemble-0.0.21}/README.md +0 -0
- {videosdk_plugins_resemble-0.0.19 → videosdk_plugins_resemble-0.0.21}/videosdk/plugins/resemble/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: videosdk-plugins-resemble
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.21
|
|
4
4
|
Summary: VideoSDK Agent Framework plugin for Resemble
|
|
5
5
|
Author: videosdk
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -12,7 +12,7 @@ Classifier: Topic :: Multimedia :: Sound/Audio
|
|
|
12
12
|
Classifier: Topic :: Multimedia :: Video
|
|
13
13
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
14
|
Requires-Python: >=3.11
|
|
15
|
-
Requires-Dist: videosdk-agents>=0.0.
|
|
15
|
+
Requires-Dist: videosdk-agents>=0.0.21
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
|
|
18
18
|
# VideoSDK Resemble Plugin
|
|
@@ -82,28 +82,44 @@ class ResembleTTS(TTS):
|
|
|
82
82
|
) as response:
|
|
83
83
|
response.raise_for_status()
|
|
84
84
|
|
|
85
|
+
audio_data = b""
|
|
85
86
|
header_processed = False
|
|
86
|
-
buffer = b''
|
|
87
87
|
|
|
88
88
|
async for chunk in response.aiter_bytes():
|
|
89
89
|
if not header_processed:
|
|
90
|
-
|
|
91
|
-
data_pos =
|
|
90
|
+
audio_data += chunk
|
|
91
|
+
data_pos = audio_data.find(b'data')
|
|
92
92
|
if data_pos != -1:
|
|
93
93
|
header_size = data_pos + 8
|
|
94
|
-
audio_data =
|
|
95
|
-
if audio_data:
|
|
96
|
-
self.loop.create_task(self.audio_track.add_new_bytes(audio_data))
|
|
94
|
+
audio_data = audio_data[header_size:]
|
|
97
95
|
header_processed = True
|
|
98
96
|
else:
|
|
99
97
|
if chunk:
|
|
100
|
-
|
|
98
|
+
audio_data += chunk
|
|
99
|
+
|
|
100
|
+
if audio_data:
|
|
101
|
+
await self._stream_audio_chunks(audio_data)
|
|
101
102
|
|
|
102
103
|
except httpx.HTTPStatusError as e:
|
|
103
104
|
self.emit("error", f"HTTP error {e.response.status_code}: {e.response.text}")
|
|
104
105
|
except Exception as e:
|
|
105
106
|
self.emit("error", f"HTTP streaming synthesis failed: {str(e)}")
|
|
106
107
|
|
|
108
|
+
async def _stream_audio_chunks(self, audio_bytes: bytes) -> None:
|
|
109
|
+
"""Stream audio data in chunks for smooth playback """
|
|
110
|
+
chunk_size = int(self.sample_rate * 1 * 2 * 20 / 1000)
|
|
111
|
+
|
|
112
|
+
for i in range(0, len(audio_bytes), chunk_size):
|
|
113
|
+
chunk = audio_bytes[i:i + chunk_size]
|
|
114
|
+
|
|
115
|
+
if len(chunk) < chunk_size and len(chunk) > 0:
|
|
116
|
+
padding_needed = chunk_size - len(chunk)
|
|
117
|
+
chunk += b'\x00' * padding_needed
|
|
118
|
+
|
|
119
|
+
if len(chunk) == chunk_size:
|
|
120
|
+
self.loop.create_task(self.audio_track.add_new_bytes(chunk))
|
|
121
|
+
await asyncio.sleep(0.001)
|
|
122
|
+
|
|
107
123
|
async def aclose(self) -> None:
|
|
108
124
|
if self._http_client:
|
|
109
125
|
await self._http_client.aclose()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.21"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.19"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|