livekit-plugins-volcenginee 1.3.2__tar.gz → 1.3.3__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.
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/PKG-INFO +10 -8
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/README.md +9 -7
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/livekit/plugins/volcengine/tts.py +29 -14
- livekit_plugins_volcenginee-1.3.3/livekit/plugins/volcengine/version.py +1 -0
- livekit_plugins_volcenginee-1.3.2/livekit/plugins/volcengine/version.py +0 -1
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/.gitignore +0 -0
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/livekit/plugins/volcengine/__init__.py +0 -0
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/livekit/plugins/volcengine/llm.py +0 -0
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/livekit/plugins/volcengine/log.py +0 -0
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/livekit/plugins/volcengine/py.typed +0 -0
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/livekit/plugins/volcengine/realtime.py +0 -0
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/livekit/plugins/volcengine/stt.py +0 -0
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/livekit/plugins/volcengine/utils.py +0 -0
- {livekit_plugins_volcenginee-1.3.2 → livekit_plugins_volcenginee-1.3.3}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: livekit-plugins-volcenginee
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: LiveKit Agent Plugins for Volcengine
|
|
5
5
|
Author-email: linsanzhu <2287225730@qq.com>
|
|
6
6
|
Keywords: audio,livekit,realtime,video,webrtc
|
|
@@ -394,18 +394,20 @@ if __name__ == "__main__":
|
|
|
394
394
|
|
|
395
395
|
```python
|
|
396
396
|
volcengine.TTS(
|
|
397
|
-
api_key: str,
|
|
398
|
-
resource_id: str | None = None,
|
|
397
|
+
api_key: str, # API Key(新版控制台)
|
|
398
|
+
resource_id: str | None = None, # 默认 seed-tts-2.0
|
|
399
399
|
voice: str = "zh_female_xiaohe_uranus_bigtts",
|
|
400
|
-
speed: float = 1.0,
|
|
401
|
-
volume: float = 1.0,
|
|
402
|
-
pitch: float = 1.0,
|
|
403
|
-
speech_rate: int = 0, # 语速,[-50, 100],100=2.0x,-50=0.5x
|
|
404
|
-
loudness_rate: int = 0, # 音量,[-50, 100],100=2.0x,-50=0.5x(mix 音色暂不支持)
|
|
400
|
+
speed: float = 1.0, # 语速倍率(OpenAI 规范),[0.2, 3.0],1.0=正常
|
|
401
|
+
volume: float = 1.0, # 音量倍率(OpenAI 规范),(0.1, 3.0],1.0=正常(mix 音色暂不支持)
|
|
402
|
+
pitch: float = 1.0, # 已废弃,保留仅用于兼容
|
|
405
403
|
sample_rate: Literal[24000, 16000, 8000] = 16000,
|
|
406
404
|
)
|
|
407
405
|
```
|
|
408
406
|
|
|
407
|
+
> `speed` / `volume` 遵循 OpenAI 接口规范(float 倍率),请求时按
|
|
408
|
+
> `speech_rate = round((speed - 1.0) * 200)`(clamp 到 `[-50, 100]`)转换为火山原生
|
|
409
|
+
> `speech_rate` / `loudness_rate` 整型字段。
|
|
410
|
+
|
|
409
411
|
### TTS 资源 ID 说明
|
|
410
412
|
|
|
411
413
|
- `seed-tts-2.0`:豆包语音合成模型 2.0
|
|
@@ -372,18 +372,20 @@ if __name__ == "__main__":
|
|
|
372
372
|
|
|
373
373
|
```python
|
|
374
374
|
volcengine.TTS(
|
|
375
|
-
api_key: str,
|
|
376
|
-
resource_id: str | None = None,
|
|
375
|
+
api_key: str, # API Key(新版控制台)
|
|
376
|
+
resource_id: str | None = None, # 默认 seed-tts-2.0
|
|
377
377
|
voice: str = "zh_female_xiaohe_uranus_bigtts",
|
|
378
|
-
speed: float = 1.0,
|
|
379
|
-
volume: float = 1.0,
|
|
380
|
-
pitch: float = 1.0,
|
|
381
|
-
speech_rate: int = 0, # 语速,[-50, 100],100=2.0x,-50=0.5x
|
|
382
|
-
loudness_rate: int = 0, # 音量,[-50, 100],100=2.0x,-50=0.5x(mix 音色暂不支持)
|
|
378
|
+
speed: float = 1.0, # 语速倍率(OpenAI 规范),[0.2, 3.0],1.0=正常
|
|
379
|
+
volume: float = 1.0, # 音量倍率(OpenAI 规范),(0.1, 3.0],1.0=正常(mix 音色暂不支持)
|
|
380
|
+
pitch: float = 1.0, # 已废弃,保留仅用于兼容
|
|
383
381
|
sample_rate: Literal[24000, 16000, 8000] = 16000,
|
|
384
382
|
)
|
|
385
383
|
```
|
|
386
384
|
|
|
385
|
+
> `speed` / `volume` 遵循 OpenAI 接口规范(float 倍率),请求时按
|
|
386
|
+
> `speech_rate = round((speed - 1.0) * 200)`(clamp 到 `[-50, 100]`)转换为火山原生
|
|
387
|
+
> `speech_rate` / `loudness_rate` 整型字段。
|
|
388
|
+
|
|
387
389
|
### TTS 资源 ID 说明
|
|
388
390
|
|
|
389
391
|
- `seed-tts-2.0`:豆包语音合成模型 2.0
|
|
@@ -24,6 +24,27 @@ from livekit.agents.types import DEFAULT_API_CONNECT_OPTIONS
|
|
|
24
24
|
from .log import logger
|
|
25
25
|
|
|
26
26
|
|
|
27
|
+
def _speed_to_speech_rate(speed: float) -> int:
|
|
28
|
+
"""Convert OpenAI-style ``speed`` (1.0 = normal) to Volcengine ``speech_rate``.
|
|
29
|
+
|
|
30
|
+
Mapping: ``speech_rate = round((speed - 1.0) * 200)``, clamped to ``[-50, 100]``.
|
|
31
|
+
|
|
32
|
+
1.0 -> 0, 1.5 -> 100, 0.5 -> -50. Values outside the OpenAI-allowed range
|
|
33
|
+
are clamped at the same boundaries used by the underlying API.
|
|
34
|
+
"""
|
|
35
|
+
rate = round((speed - 1.0) * 200)
|
|
36
|
+
return max(-50, min(100, rate))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _volume_to_loudness_rate(volume: float) -> int:
|
|
40
|
+
"""Convert OpenAI-style ``volume`` (1.0 = normal) to Volcengine ``loudness_rate``.
|
|
41
|
+
|
|
42
|
+
Same mapping as ``_speed_to_speech_rate``.
|
|
43
|
+
"""
|
|
44
|
+
rate = round((volume - 1.0) * 200)
|
|
45
|
+
return max(-50, min(100, rate))
|
|
46
|
+
|
|
47
|
+
|
|
27
48
|
class _TTSOptions(BaseModel):
|
|
28
49
|
api_key: str
|
|
29
50
|
resource_id: str | None = None
|
|
@@ -31,11 +52,11 @@ class _TTSOptions(BaseModel):
|
|
|
31
52
|
base_url: str = "https://openspeech.bytedance.com"
|
|
32
53
|
sample_rate: Literal[24000, 16000, 8000] = 24000
|
|
33
54
|
encoding: Literal["mp3", "pcm"] = "pcm"
|
|
55
|
+
# OpenAI-style primary interface; converted to Volcengine speech_rate/loudness_rate
|
|
56
|
+
# at request time (see _speed_to_speech_rate / _volume_to_loudness_rate).
|
|
34
57
|
speed: float = Field(1.0, ge=0.2, le=3.0)
|
|
35
58
|
volume: float = Field(1.0, gt=0.1, le=3.0)
|
|
36
59
|
pitch: float = Field(1.0, ge=0.1, le=3.0)
|
|
37
|
-
speech_rate: int = Field(0, ge=-50, le=100)
|
|
38
|
-
loudness_rate: int = Field(0, ge=-50, le=100)
|
|
39
60
|
|
|
40
61
|
def get_http_url(self) -> str:
|
|
41
62
|
return f"{self.base_url}/api/v3/tts/unidirectional"
|
|
@@ -55,8 +76,8 @@ class _TTSOptions(BaseModel):
|
|
|
55
76
|
"audio_params": {
|
|
56
77
|
"format": self.encoding,
|
|
57
78
|
"sample_rate": self.sample_rate,
|
|
58
|
-
"loudness_rate": self.
|
|
59
|
-
"speech_rate": self.
|
|
79
|
+
"loudness_rate": _volume_to_loudness_rate(self.volume),
|
|
80
|
+
"speech_rate": _speed_to_speech_rate(self.speed),
|
|
60
81
|
},
|
|
61
82
|
"request_id": reqid,
|
|
62
83
|
},
|
|
@@ -85,8 +106,6 @@ class TTS(tts.TTS):
|
|
|
85
106
|
speed: float = 1.0,
|
|
86
107
|
volume: float = 1.0,
|
|
87
108
|
pitch: float = 1.0,
|
|
88
|
-
speech_rate: int = 0,
|
|
89
|
-
loudness_rate: int = 0,
|
|
90
109
|
sample_rate: Literal[24000, 16000, 8000] = 16000,
|
|
91
110
|
http_session: aiohttp.ClientSession | None = None,
|
|
92
111
|
):
|
|
@@ -96,12 +115,10 @@ class TTS(tts.TTS):
|
|
|
96
115
|
api_key (str): the API key of the tts, you can get it from the new console.
|
|
97
116
|
resource_id (str | None, optional): VolcEngine TTS resource id. Use `seed-tts-2.0` for Doubao TTS 2.0 voices, `seed-tts-1.0` / `seed-tts-1.0-concurr` for Doubao TTS 1.0 voices, `seed-icl-2.0` for voice cloning 2.0, and `seed-icl-1.0` / `seed-icl-1.0-concurr` for voice cloning 1.0. Defaults to None.
|
|
98
117
|
voice (str, optional): the voice id used by the tts request. Defaults to `zh_female_xiaohe_uranus_bigtts`.
|
|
99
|
-
speed (float, optional):
|
|
100
|
-
volume (float, optional):
|
|
101
|
-
pitch (float, optional): kept for backwards compatibility,
|
|
102
|
-
|
|
103
|
-
loudness_rate (int, optional): volume gain, range [-50, 100]. 100 = 2.0x, -50 = 0.5x. Not supported for mix voices. Defaults to 0 (normal).
|
|
104
|
-
sample_rate (Literal[24000, 16000, 8000], optional): the sample rate of the tts. Defaults to 24000.
|
|
118
|
+
speed (float, optional): speech rate multiplier (OpenAI-style). Range [0.2, 3.0]; 1.0 = normal, 2.0 = 2x, 0.5 = 0.5x. Internally converted to the Volcengine ``speech_rate`` int. Defaults to 1.0.
|
|
119
|
+
volume (float, optional): volume multiplier (OpenAI-style). Range (0.1, 3.0]; 1.0 = normal, 2.0 = 2x, 0.5 = 0.5x. Internally converted to the Volcengine ``loudness_rate`` int. Not supported for mix voices. Defaults to 1.0.
|
|
120
|
+
pitch (float, optional): kept for backwards compatibility, not currently sent to the API. Defaults to 1.0.
|
|
121
|
+
sample_rate (Literal[24000, 16000, 8000], optional): the sample rate of the tts. Defaults to 16000.
|
|
105
122
|
streaming (bool, optional): whether to use the streaming api. Defaults to True.
|
|
106
123
|
http_session (aiohttp.ClientSession | None, optional): the http session to use. Defaults to None.
|
|
107
124
|
"""
|
|
@@ -118,8 +135,6 @@ class TTS(tts.TTS):
|
|
|
118
135
|
speed=speed,
|
|
119
136
|
volume=volume,
|
|
120
137
|
pitch=pitch,
|
|
121
|
-
speech_rate=speech_rate,
|
|
122
|
-
loudness_rate=loudness_rate,
|
|
123
138
|
)
|
|
124
139
|
self._session = http_session
|
|
125
140
|
self._streams = weakref.WeakSet[SynthesizeStream]()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.3"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.3.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|