livekit-plugins-resemble 0.1.1__tar.gz → 1.0.0rc9__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.
- livekit_plugins_resemble-1.0.0rc9/.gitignore +168 -0
- {livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/PKG-INFO +12 -20
- {livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/livekit/plugins/resemble/tts.py +6 -10
- {livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/livekit/plugins/resemble/version.py +1 -1
- livekit_plugins_resemble-1.0.0rc9/pyproject.toml +41 -0
- livekit_plugins_resemble-0.1.1/livekit_plugins_resemble.egg-info/PKG-INFO +0 -149
- livekit_plugins_resemble-0.1.1/livekit_plugins_resemble.egg-info/SOURCES.txt +0 -14
- livekit_plugins_resemble-0.1.1/livekit_plugins_resemble.egg-info/dependency_links.txt +0 -1
- livekit_plugins_resemble-0.1.1/livekit_plugins_resemble.egg-info/requires.txt +0 -1
- livekit_plugins_resemble-0.1.1/livekit_plugins_resemble.egg-info/top_level.txt +0 -1
- livekit_plugins_resemble-0.1.1/pyproject.toml +0 -3
- livekit_plugins_resemble-0.1.1/setup.cfg +0 -4
- livekit_plugins_resemble-0.1.1/setup.py +0 -55
- {livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/README.md +0 -0
- {livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/livekit/plugins/resemble/__init__.py +0 -0
- {livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/livekit/plugins/resemble/log.py +0 -0
- {livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/livekit/plugins/resemble/models.py +0 -0
- {livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/livekit/plugins/resemble/py.typed +0 -0
|
@@ -0,0 +1,168 @@
|
|
|
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,33 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: livekit-plugins-resemble
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0rc9
|
|
4
4
|
Summary: LiveKit Agents Plugin for Resemble AI
|
|
5
|
-
Home-page: https://github.com/livekit/agents
|
|
6
|
-
License: Apache-2.0
|
|
7
5
|
Project-URL: Documentation, https://docs.livekit.io
|
|
8
6
|
Project-URL: Website, https://livekit.io/
|
|
9
7
|
Project-URL: Source, https://github.com/livekit/agents
|
|
10
|
-
|
|
8
|
+
Author-email: LiveKit <hello@livekit.io>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
Keywords: audio,livekit,realtime,video,webrtc
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier:
|
|
13
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
13
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
17
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
18
|
+
Classifier: Topic :: Multimedia :: Video
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
20
|
Requires-Python: >=3.9.0
|
|
21
|
+
Requires-Dist: livekit-agents>=1.0.0.rc9
|
|
19
22
|
Description-Content-Type: text/markdown
|
|
20
|
-
Requires-Dist: livekit-agents[codecs]>=0.12.10
|
|
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
23
|
|
|
32
24
|
# LiveKit Plugins Resemble
|
|
33
25
|
|
|
@@ -146,4 +138,4 @@ This plugin uses two different approaches to generate speech:
|
|
|
146
138
|
1. **One-off Synthesis** - Uses Resemble's REST API for simple text-to-speech conversion
|
|
147
139
|
2. **Streaming Synthesis** - Uses Resemble's WebSocket API for real-time streaming synthesis
|
|
148
140
|
|
|
149
|
-
The WebSocket streaming API is only available for Resemble AI Business plan users.
|
|
141
|
+
The WebSocket streaming API is only available for Resemble AI Business plan users.
|
{livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/livekit/plugins/resemble/tts.py
RENAMED
|
@@ -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
|
|
24
23
|
|
|
25
24
|
import aiohttp
|
|
25
|
+
|
|
26
26
|
from livekit.agents import (
|
|
27
27
|
APIConnectionError,
|
|
28
28
|
APIConnectOptions,
|
|
@@ -83,14 +83,13 @@ 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
|
|
86
|
+
"Resemble API key is required, either as argument or set RESEMBLE_API_KEY"
|
|
87
|
+
" environment variable"
|
|
87
88
|
)
|
|
88
89
|
self._api_key = api_key
|
|
89
90
|
|
|
90
91
|
if tokenizer is None:
|
|
91
|
-
tokenizer = tokenize.basic.SentenceTokenizer(
|
|
92
|
-
min_sentence_len=BUFFERED_WORDS_COUNT
|
|
93
|
-
)
|
|
92
|
+
tokenizer = tokenize.basic.SentenceTokenizer(min_sentence_len=BUFFERED_WORDS_COUNT)
|
|
94
93
|
|
|
95
94
|
if voice_uuid is None:
|
|
96
95
|
voice_uuid = DEFAULT_VOICE_UUID
|
|
@@ -151,7 +150,7 @@ class TTS(tts.TTS):
|
|
|
151
150
|
self,
|
|
152
151
|
text: str,
|
|
153
152
|
*,
|
|
154
|
-
conn_options:
|
|
153
|
+
conn_options: APIConnectOptions | None = None,
|
|
155
154
|
) -> ChunkedStream:
|
|
156
155
|
return ChunkedStream(
|
|
157
156
|
tts=self,
|
|
@@ -162,9 +161,7 @@ class TTS(tts.TTS):
|
|
|
162
161
|
session=self._ensure_session(),
|
|
163
162
|
)
|
|
164
163
|
|
|
165
|
-
def stream(
|
|
166
|
-
self, *, conn_options: Optional[APIConnectOptions] = None
|
|
167
|
-
) -> SynthesizeStream:
|
|
164
|
+
def stream(self, *, conn_options: APIConnectOptions | None = None) -> SynthesizeStream:
|
|
168
165
|
stream = SynthesizeStream(
|
|
169
166
|
tts=self,
|
|
170
167
|
pool=self._pool,
|
|
@@ -215,7 +212,6 @@ class ChunkedStream(tts.ChunkedStream):
|
|
|
215
212
|
"sample_rate": self._opts.sample_rate,
|
|
216
213
|
"precision": "PCM_16",
|
|
217
214
|
}
|
|
218
|
-
|
|
219
215
|
decoder = utils.codecs.AudioStreamDecoder(
|
|
220
216
|
sample_rate=self._opts.sample_rate,
|
|
221
217
|
num_channels=NUM_CHANNELS,
|
|
@@ -0,0 +1,41 @@
|
|
|
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.rc9",
|
|
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"]
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: livekit-plugins-resemble
|
|
3
|
-
Version: 0.1.1
|
|
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.10
|
|
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.
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
livekit-agents[codecs]>=0.12.10
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
livekit
|
|
@@ -1,55 +0,0 @@
|
|
|
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.10"],
|
|
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
|
-
)
|
|
File without changes
|
|
File without changes
|
{livekit_plugins_resemble-0.1.1 → livekit_plugins_resemble-1.0.0rc9}/livekit/plugins/resemble/log.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|