livekit-plugins-resemble 0.1.0rc1__tar.gz → 0.1.2__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 livekit-plugins-resemble might be problematic. Click here for more details.

Files changed (18) hide show
  1. {livekit_plugins_resemble-0.1.0rc1 → livekit_plugins_resemble-0.1.2}/PKG-INFO +20 -12
  2. {livekit_plugins_resemble-0.1.0rc1 → livekit_plugins_resemble-0.1.2}/livekit/plugins/resemble/tts.py +10 -6
  3. {livekit_plugins_resemble-0.1.0rc1 → livekit_plugins_resemble-0.1.2}/livekit/plugins/resemble/version.py +1 -1
  4. livekit_plugins_resemble-0.1.2/livekit_plugins_resemble.egg-info/PKG-INFO +149 -0
  5. livekit_plugins_resemble-0.1.2/livekit_plugins_resemble.egg-info/SOURCES.txt +14 -0
  6. livekit_plugins_resemble-0.1.2/livekit_plugins_resemble.egg-info/dependency_links.txt +1 -0
  7. livekit_plugins_resemble-0.1.2/livekit_plugins_resemble.egg-info/requires.txt +1 -0
  8. livekit_plugins_resemble-0.1.2/livekit_plugins_resemble.egg-info/top_level.txt +1 -0
  9. livekit_plugins_resemble-0.1.2/pyproject.toml +3 -0
  10. livekit_plugins_resemble-0.1.2/setup.cfg +4 -0
  11. livekit_plugins_resemble-0.1.2/setup.py +55 -0
  12. livekit_plugins_resemble-0.1.0rc1/.gitignore +0 -168
  13. livekit_plugins_resemble-0.1.0rc1/pyproject.toml +0 -41
  14. {livekit_plugins_resemble-0.1.0rc1 → livekit_plugins_resemble-0.1.2}/README.md +0 -0
  15. {livekit_plugins_resemble-0.1.0rc1 → livekit_plugins_resemble-0.1.2}/livekit/plugins/resemble/__init__.py +0 -0
  16. {livekit_plugins_resemble-0.1.0rc1 → livekit_plugins_resemble-0.1.2}/livekit/plugins/resemble/log.py +0 -0
  17. {livekit_plugins_resemble-0.1.0rc1 → livekit_plugins_resemble-0.1.2}/livekit/plugins/resemble/models.py +0 -0
  18. {livekit_plugins_resemble-0.1.0rc1 → livekit_plugins_resemble-0.1.2}/livekit/plugins/resemble/py.typed +0 -0
@@ -1,25 +1,33 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: livekit-plugins-resemble
3
- Version: 0.1.0rc1
3
+ Version: 0.1.2
4
4
  Summary: LiveKit Agents Plugin for Resemble AI
5
+ Home-page: https://github.com/livekit/agents
6
+ License: Apache-2.0
5
7
  Project-URL: Documentation, https://docs.livekit.io
6
8
  Project-URL: Website, https://livekit.io/
7
9
  Project-URL: Source, https://github.com/livekit/agents
8
- Author-email: LiveKit <hello@livekit.io>
9
- License-Expression: Apache-2.0
10
- Keywords: audio,livekit,realtime,video,webrtc
10
+ Keywords: webrtc,realtime,audio,video,livekit,resemble,tts
11
11
  Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: Apache Software License
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3 :: Only
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
12
  Classifier: Topic :: Multimedia :: Sound/Audio
18
- Classifier: Topic :: Multimedia :: Video
19
13
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3 :: Only
20
18
  Requires-Python: >=3.9.0
21
- Requires-Dist: livekit-agents>=1.0.0.rc7
22
19
  Description-Content-Type: text/markdown
20
+ Requires-Dist: livekit-agents[codecs]>=0.12.20
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: keywords
26
+ Dynamic: license
27
+ Dynamic: project-url
28
+ Dynamic: requires-dist
29
+ Dynamic: requires-python
30
+ Dynamic: summary
23
31
 
24
32
  # LiveKit Plugins Resemble
25
33
 
@@ -138,4 +146,4 @@ This plugin uses two different approaches to generate speech:
138
146
  1. **One-off Synthesis** - Uses Resemble's REST API for simple text-to-speech conversion
139
147
  2. **Streaming Synthesis** - Uses Resemble's WebSocket API for real-time streaming synthesis
140
148
 
141
- The WebSocket streaming API is only available for Resemble AI Business plan users.
149
+ The WebSocket streaming API is only available for Resemble AI Business plan users.
@@ -20,9 +20,9 @@ import json
20
20
  import os
21
21
  import weakref
22
22
  from dataclasses import dataclass
23
+ from typing import Optional
23
24
 
24
25
  import aiohttp
25
-
26
26
  from livekit.agents import (
27
27
  APIConnectionError,
28
28
  APIConnectOptions,
@@ -83,13 +83,14 @@ class TTS(tts.TTS):
83
83
  api_key = api_key or os.environ.get("RESEMBLE_API_KEY")
84
84
  if not api_key:
85
85
  raise ValueError(
86
- "Resemble API key is required, either as argument or set RESEMBLE_API_KEY"
87
- " environment variable"
86
+ "Resemble API key is required, either as argument or set RESEMBLE_API_KEY environment variable"
88
87
  )
89
88
  self._api_key = api_key
90
89
 
91
90
  if tokenizer is None:
92
- tokenizer = tokenize.basic.SentenceTokenizer(min_sentence_len=BUFFERED_WORDS_COUNT)
91
+ tokenizer = tokenize.basic.SentenceTokenizer(
92
+ min_sentence_len=BUFFERED_WORDS_COUNT
93
+ )
93
94
 
94
95
  if voice_uuid is None:
95
96
  voice_uuid = DEFAULT_VOICE_UUID
@@ -150,7 +151,7 @@ class TTS(tts.TTS):
150
151
  self,
151
152
  text: str,
152
153
  *,
153
- conn_options: APIConnectOptions | None = None,
154
+ conn_options: Optional[APIConnectOptions] = None,
154
155
  ) -> ChunkedStream:
155
156
  return ChunkedStream(
156
157
  tts=self,
@@ -161,7 +162,9 @@ class TTS(tts.TTS):
161
162
  session=self._ensure_session(),
162
163
  )
163
164
 
164
- def stream(self, *, conn_options: APIConnectOptions | None = None) -> SynthesizeStream:
165
+ def stream(
166
+ self, *, conn_options: Optional[APIConnectOptions] = None
167
+ ) -> SynthesizeStream:
165
168
  stream = SynthesizeStream(
166
169
  tts=self,
167
170
  pool=self._pool,
@@ -212,6 +215,7 @@ class ChunkedStream(tts.ChunkedStream):
212
215
  "sample_rate": self._opts.sample_rate,
213
216
  "precision": "PCM_16",
214
217
  }
218
+
215
219
  decoder = utils.codecs.AudioStreamDecoder(
216
220
  sample_rate=self._opts.sample_rate,
217
221
  num_channels=NUM_CHANNELS,
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = '0.1.0.rc1'
15
+ __version__ = "0.1.2"
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: livekit-plugins-resemble
3
+ Version: 0.1.2
4
+ Summary: LiveKit Agents Plugin for Resemble AI
5
+ Home-page: https://github.com/livekit/agents
6
+ License: Apache-2.0
7
+ Project-URL: Documentation, https://docs.livekit.io
8
+ Project-URL: Website, https://livekit.io/
9
+ Project-URL: Source, https://github.com/livekit/agents
10
+ Keywords: webrtc,realtime,audio,video,livekit,resemble,tts
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Topic :: Multimedia :: Sound/Audio
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Requires-Python: >=3.9.0
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: livekit-agents[codecs]>=0.12.20
21
+ Dynamic: classifier
22
+ Dynamic: description
23
+ Dynamic: description-content-type
24
+ Dynamic: home-page
25
+ Dynamic: keywords
26
+ Dynamic: license
27
+ Dynamic: project-url
28
+ Dynamic: requires-dist
29
+ Dynamic: requires-python
30
+ Dynamic: summary
31
+
32
+ # LiveKit Plugins Resemble
33
+
34
+ Agent Framework plugin for voice synthesis with the [Resemble AI](https://www.resemble.ai/) API, using both their REST API and WebSocket streaming interface.
35
+
36
+ ## Installation
37
+
38
+ ```bash
39
+ pip install livekit-plugins-resemble
40
+ ```
41
+
42
+ ## Pre-requisites
43
+
44
+ You'll need an API key from Resemble AI. It can be set as an environment variable: `RESEMBLE_API_KEY`
45
+
46
+ Additionally, you'll need the voice UUID from your Resemble AI account.
47
+
48
+ ## Examples
49
+
50
+ ### Recommended
51
+
52
+ ```python
53
+ import asyncio
54
+ from livekit.plugins.resemble import TTS
55
+
56
+ async def run_tts_example():
57
+ # Use TTS with async context manager for automatic resource cleanup
58
+ async with TTS(
59
+ api_key="your_api_key", # or set RESEMBLE_API_KEY environment variable
60
+ voice_uuid="your_voice_uuid",
61
+ # Optional parameters
62
+ sample_rate=44100, # Sample rate in Hz (default: 44100)
63
+ precision="PCM_16", # Audio precision (PCM_32, PCM_24, PCM_16, MULAW)
64
+ output_format="wav", # Output format (wav or mp3)
65
+ ) as tts:
66
+ # One-off synthesis (uses REST API)
67
+ audio_stream = tts.synthesize("Hello, world!")
68
+
69
+ # Process chunks as they arrive
70
+ async for chunk in audio_stream:
71
+ # Audio data is in the 'frame.data' attribute of SynthesizedAudio objects
72
+ audio_data = chunk.frame.data
73
+ print(f"Received chunk: {len(audio_data)} bytes")
74
+
75
+ # Alternative: collect all audio at once into a single AudioFrame
76
+ audio_stream = tts.synthesize("Another example sentence.")
77
+ audio_frame = await audio_stream.collect()
78
+ print(f"Collected complete audio: {len(audio_frame.data)} bytes")
79
+
80
+ # Real-time streaming synthesis (uses WebSocket API)
81
+ # Only available for Business plan users in Resemble AI
82
+ stream = tts.stream()
83
+ await stream.synthesize_text("Hello, world!")
84
+
85
+
86
+
87
+ # Run the example
88
+ asyncio.run(run_tts_example())
89
+ ```
90
+
91
+ ### Alternative: Manual Resource Management
92
+
93
+ If you prefer to manage resources manually, make sure to properly clean up:
94
+
95
+ ```python
96
+ import asyncio
97
+ from livekit.plugins.resemble import TTS
98
+
99
+ async def run_tts_example():
100
+ # Initialize TTS with your credentials
101
+ tts = TTS(
102
+ api_key="your_api_key",
103
+ voice_uuid="your_voice_uuid",
104
+ )
105
+
106
+ try:
107
+ # TTS operations
108
+ audio_stream = tts.synthesize("Hello, world!")
109
+ async for chunk in audio_stream:
110
+ # Access audio data correctly
111
+ process_audio(chunk.frame.data)
112
+ finally:
113
+ # Always clean up resources when done
114
+ await tts.aclose()
115
+
116
+ # Run the example
117
+ asyncio.run(run_tts_example())
118
+ ```
119
+
120
+ ### Resource Management
121
+
122
+ When using this plugin outside of the LiveKit agent framework, it's important to properly manage the TTS instance lifecycle:
123
+
124
+ 1. **Preferred method**: Use the async context manager pattern (`async with TTS(...) as tts:`)
125
+ 2. If managing manually, always call `await tts.aclose()` in a finally block
126
+ 3. If you prefer to provide your own HTTP session, you can pass it using the `http_session` parameter:
127
+
128
+ ```python
129
+ import aiohttp
130
+
131
+ async def with_custom_session():
132
+ async with aiohttp.ClientSession() as session:
133
+ async with TTS(
134
+ api_key="your_api_key",
135
+ voice_uuid="your_voice_uuid",
136
+ http_session=session
137
+ ) as tts:
138
+ # Use TTS...
139
+ # No need to manually close anything - context managers handle it all
140
+ ```
141
+
142
+ ## Implementation Details
143
+
144
+ This plugin uses two different approaches to generate speech:
145
+
146
+ 1. **One-off Synthesis** - Uses Resemble's REST API for simple text-to-speech conversion
147
+ 2. **Streaming Synthesis** - Uses Resemble's WebSocket API for real-time streaming synthesis
148
+
149
+ The WebSocket streaming API is only available for Resemble AI Business plan users.
@@ -0,0 +1,14 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ livekit/plugins/resemble/__init__.py
5
+ livekit/plugins/resemble/log.py
6
+ livekit/plugins/resemble/models.py
7
+ livekit/plugins/resemble/py.typed
8
+ livekit/plugins/resemble/tts.py
9
+ livekit/plugins/resemble/version.py
10
+ livekit_plugins_resemble.egg-info/PKG-INFO
11
+ livekit_plugins_resemble.egg-info/SOURCES.txt
12
+ livekit_plugins_resemble.egg-info/dependency_links.txt
13
+ livekit_plugins_resemble.egg-info/requires.txt
14
+ livekit_plugins_resemble.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ livekit-agents[codecs]>=0.12.20
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,55 @@
1
+ # Copyright 2023 LiveKit, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import os
16
+ import pathlib
17
+
18
+ import setuptools
19
+ import setuptools.command.build_py
20
+
21
+ here = pathlib.Path(__file__).parent.resolve()
22
+ about = {}
23
+ with open(os.path.join(here, "livekit", "plugins", "resemble", "version.py"), "r") as f:
24
+ exec(f.read(), about)
25
+
26
+
27
+ setuptools.setup(
28
+ name="livekit-plugins-resemble",
29
+ version=about["__version__"],
30
+ description="LiveKit Agents Plugin for Resemble AI",
31
+ long_description=(here / "README.md").read_text(encoding="utf-8"),
32
+ long_description_content_type="text/markdown",
33
+ url="https://github.com/livekit/agents",
34
+ cmdclass={},
35
+ classifiers=[
36
+ "Intended Audience :: Developers",
37
+ "Topic :: Multimedia :: Sound/Audio",
38
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
39
+ "Programming Language :: Python :: 3",
40
+ "Programming Language :: Python :: 3.11",
41
+ "Programming Language :: Python :: 3.12",
42
+ "Programming Language :: Python :: 3 :: Only",
43
+ ],
44
+ keywords=["webrtc", "realtime", "audio", "video", "livekit", "resemble", "tts"],
45
+ license="Apache-2.0",
46
+ packages=setuptools.find_namespace_packages(include=["livekit.*"]),
47
+ python_requires=">=3.9.0",
48
+ install_requires=["livekit-agents[codecs]>=0.12.20"],
49
+ package_data={"livekit.plugins.resemble": ["py.typed"]},
50
+ project_urls={
51
+ "Documentation": "https://docs.livekit.io",
52
+ "Website": "https://livekit.io/",
53
+ "Source": "https://github.com/livekit/agents",
54
+ },
55
+ )
@@ -1,168 +0,0 @@
1
- **/.vscode
2
- **/.DS_Store
3
-
4
- # Byte-compiled / optimized / DLL files
5
- __pycache__/
6
- *.py[cod]
7
- *$py.class
8
-
9
- # C extensions
10
- *.so
11
-
12
- # Distribution / packaging
13
- .Python
14
- build/
15
- develop-eggs/
16
- dist/
17
- downloads/
18
- eggs/
19
- .eggs/
20
- lib/
21
- lib64/
22
- parts/
23
- sdist/
24
- var/
25
- wheels/
26
- share/python-wheels/
27
- *.egg-info/
28
- .installed.cfg
29
- *.egg
30
- MANIFEST
31
-
32
- # PyInstaller
33
- # Usually these files are written by a python script from a template
34
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
- *.manifest
36
- *.spec
37
-
38
- # Installer logs
39
- pip-log.txt
40
- pip-delete-this-directory.txt
41
-
42
- # Unit test / coverage reports
43
- htmlcov/
44
- .tox/
45
- .nox/
46
- .coverage
47
- .coverage.*
48
- .cache
49
- nosetests.xml
50
- coverage.xml
51
- *.cover
52
- *.py,cover
53
- .hypothesis/
54
- .pytest_cache/
55
- cover/
56
-
57
- # Translations
58
- *.mo
59
- *.pot
60
-
61
- # Django stuff:
62
- *.log
63
- local_settings.py
64
- db.sqlite3
65
- db.sqlite3-journal
66
-
67
- # Flask stuff:
68
- instance/
69
- .webassets-cache
70
-
71
- # Scrapy stuff:
72
- .scrapy
73
-
74
- # Sphinx documentation
75
- docs/_build/
76
-
77
- # PyBuilder
78
- .pybuilder/
79
- target/
80
-
81
- # Jupyter Notebook
82
- .ipynb_checkpoints
83
-
84
- # IPython
85
- profile_default/
86
- ipython_config.py
87
-
88
- # pyenv
89
- # For a library or package, you might want to ignore these files since the code is
90
- # intended to run in multiple environments; otherwise, check them in:
91
- # .python-version
92
-
93
- # pipenv
94
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
- # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
- # install all needed dependencies.
98
- #Pipfile.lock
99
-
100
- # poetry
101
- # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102
- # This is especially recommended for binary packages to ensure reproducibility, and is more
103
- # commonly ignored for libraries.
104
- # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105
- #poetry.lock
106
-
107
- # pdm
108
- # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
109
- #pdm.lock
110
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
111
- # in version control.
112
- # https://pdm.fming.dev/#use-with-ide
113
- .pdm.toml
114
-
115
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116
- __pypackages__/
117
-
118
- # Celery stuff
119
- celerybeat-schedule
120
- celerybeat.pid
121
-
122
- # SageMath parsed files
123
- *.sage.py
124
-
125
- # Environments
126
- .env
127
- .venv
128
- env/
129
- venv/
130
- ENV/
131
- env.bak/
132
- venv.bak/
133
-
134
- # Spyder project settings
135
- .spyderproject
136
- .spyproject
137
-
138
- # Rope project settings
139
- .ropeproject
140
-
141
- # mkdocs documentation
142
- /site
143
-
144
- # mypy
145
- .mypy_cache/
146
- .dmypy.json
147
- dmypy.json
148
-
149
- # Pyre type checker
150
- .pyre/
151
-
152
- # pytype static type analyzer
153
- .pytype/
154
-
155
- # Cython debug symbols
156
- cython_debug/
157
-
158
- # PyCharm
159
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
160
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
161
- # and can be added to the global gitignore or merged into this file. For a more nuclear
162
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
163
- .idea/
164
-
165
- node_modules
166
-
167
- credentials.json
168
- pyrightconfig.json
@@ -1,41 +0,0 @@
1
- [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "livekit-plugins-resemble"
7
- dynamic = ["version"]
8
- description = "LiveKit Agents Plugin for Resemble AI"
9
- readme = "README.md"
10
- license = "Apache-2.0"
11
- requires-python = ">=3.9.0"
12
- authors = [{ name = "LiveKit", email = "hello@livekit.io" }]
13
- keywords = ["webrtc", "realtime", "audio", "video", "livekit"]
14
- classifiers = [
15
- "Intended Audience :: Developers",
16
- "License :: OSI Approved :: Apache Software License",
17
- "Topic :: Multimedia :: Sound/Audio",
18
- "Topic :: Multimedia :: Video",
19
- "Topic :: Scientific/Engineering :: Artificial Intelligence",
20
- "Programming Language :: Python :: 3",
21
- "Programming Language :: Python :: 3.9",
22
- "Programming Language :: Python :: 3.10",
23
- "Programming Language :: Python :: 3 :: Only",
24
- ]
25
- dependencies = [
26
- "livekit-agents>=1.0.0.rc7",
27
- ]
28
-
29
- [project.urls]
30
- Documentation = "https://docs.livekit.io"
31
- Website = "https://livekit.io/"
32
- Source = "https://github.com/livekit/agents"
33
-
34
- [tool.hatch.version]
35
- path = "livekit/plugins/resemble/version.py"
36
-
37
- [tool.hatch.build.targets.wheel]
38
- packages = ["livekit"]
39
-
40
- [tool.hatch.build.targets.sdist]
41
- include = ["/livekit"]