cartesia 0.1.0__py2.py3-none-any.whl → 1.0.0__py2.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.
- cartesia/__init__.py +2 -2
- cartesia/_types.py +33 -38
- cartesia/client.py +874 -0
- cartesia/version.py +1 -1
- cartesia-1.0.0.dist-info/METADATA +364 -0
- cartesia-1.0.0.dist-info/RECORD +9 -0
- cartesia/tts.py +0 -701
- cartesia-0.1.0.dist-info/METADATA +0 -189
- cartesia-0.1.0.dist-info/RECORD +0 -9
- {cartesia-0.1.0.dist-info → cartesia-1.0.0.dist-info}/WHEEL +0 -0
- {cartesia-0.1.0.dist-info → cartesia-1.0.0.dist-info}/top_level.txt +0 -0
cartesia/__init__.py
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
from cartesia.
|
1
|
+
from cartesia.client import Cartesia, AsyncCartesia
|
2
2
|
|
3
|
-
__all__ = ["
|
3
|
+
__all__ = ["Cartesia", "AsyncCartesia"]
|
cartesia/_types.py
CHANGED
@@ -1,42 +1,37 @@
|
|
1
|
-
from
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
FP32_44100 = "fp32_44100" # float32, 44.1 kHz
|
25
|
-
PCM_16000 = "pcm_16000" # 16-bit signed integer PCM, 16 kHz
|
26
|
-
PCM_22050 = "pcm_22050" # 16-bit signed integer PCM, 22.05 kHz
|
27
|
-
PCM_44100 = "pcm_44100" # 16-bit signed integer PCM, 44.1 kHz
|
28
|
-
|
29
|
-
|
30
|
-
class AudioOutput(TypedDict):
|
31
|
-
audio: Union[bytes, "np.ndarray"]
|
32
|
-
sampling_rate: int
|
33
|
-
|
34
|
-
|
35
|
-
Embedding = List[float]
|
36
|
-
|
37
|
-
|
1
|
+
from typing import List, TypedDict
|
2
|
+
|
3
|
+
class OutputFormatMapping:
|
4
|
+
_format_mapping = {
|
5
|
+
"fp32": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 44100},
|
6
|
+
"pcm": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 44100},
|
7
|
+
"fp32_16000": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 16000},
|
8
|
+
"fp32_22050": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 22050},
|
9
|
+
"fp32_44100": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 44100},
|
10
|
+
"pcm_16000": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 16000},
|
11
|
+
"pcm_22050": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 22050},
|
12
|
+
"pcm_44100": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 44100},
|
13
|
+
"mulaw_8000": {"container": "raw", "encoding": "pcm_mulaw", "sample_rate": 8000},
|
14
|
+
"alaw_8000": {"container": "raw", "encoding": "pcm_alaw", "sample_rate": 8000},
|
15
|
+
}
|
16
|
+
|
17
|
+
@classmethod
|
18
|
+
def get_format(cls, format_name):
|
19
|
+
if format_name in cls._format_mapping:
|
20
|
+
return cls._format_mapping[format_name]
|
21
|
+
else:
|
22
|
+
raise ValueError(f"Unsupported format: {format_name}")
|
23
|
+
|
38
24
|
class VoiceMetadata(TypedDict):
|
39
25
|
id: str
|
40
26
|
name: str
|
41
27
|
description: str
|
42
|
-
embedding:
|
28
|
+
embedding: List[float]
|
29
|
+
is_public: bool
|
30
|
+
user_id: str
|
31
|
+
created_at: str
|
32
|
+
language: str
|
33
|
+
|
34
|
+
class OutputFormat(TypedDict):
|
35
|
+
container: str
|
36
|
+
encoding: str
|
37
|
+
sample_rate: int
|