cartesia 1.3.1__py3-none-any.whl → 2.0.0__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.
Files changed (181) hide show
  1. cartesia/__init__.py +302 -3
  2. cartesia/api_status/__init__.py +6 -0
  3. cartesia/api_status/client.py +104 -0
  4. cartesia/api_status/requests/__init__.py +5 -0
  5. cartesia/api_status/requests/api_info.py +8 -0
  6. cartesia/api_status/types/__init__.py +5 -0
  7. cartesia/api_status/types/api_info.py +20 -0
  8. cartesia/base_client.py +156 -0
  9. cartesia/client.py +163 -40
  10. cartesia/core/__init__.py +50 -0
  11. cartesia/core/api_error.py +15 -0
  12. cartesia/core/client_wrapper.py +55 -0
  13. cartesia/core/datetime_utils.py +28 -0
  14. cartesia/core/file.py +67 -0
  15. cartesia/core/http_client.py +499 -0
  16. cartesia/core/jsonable_encoder.py +101 -0
  17. cartesia/core/pagination.py +88 -0
  18. cartesia/core/pydantic_utilities.py +296 -0
  19. cartesia/core/query_encoder.py +58 -0
  20. cartesia/core/remove_none_from_dict.py +11 -0
  21. cartesia/core/request_options.py +35 -0
  22. cartesia/core/serialization.py +272 -0
  23. cartesia/datasets/__init__.py +24 -0
  24. cartesia/datasets/requests/__init__.py +15 -0
  25. cartesia/datasets/requests/create_dataset_request.py +7 -0
  26. cartesia/datasets/requests/dataset.py +9 -0
  27. cartesia/datasets/requests/dataset_file.py +9 -0
  28. cartesia/datasets/requests/paginated_dataset_files.py +10 -0
  29. cartesia/datasets/requests/paginated_datasets.py +10 -0
  30. cartesia/datasets/types/__init__.py +17 -0
  31. cartesia/datasets/types/create_dataset_request.py +19 -0
  32. cartesia/datasets/types/dataset.py +21 -0
  33. cartesia/datasets/types/dataset_file.py +21 -0
  34. cartesia/datasets/types/file_purpose.py +5 -0
  35. cartesia/datasets/types/paginated_dataset_files.py +21 -0
  36. cartesia/datasets/types/paginated_datasets.py +21 -0
  37. cartesia/embedding/__init__.py +5 -0
  38. cartesia/embedding/types/__init__.py +5 -0
  39. cartesia/embedding/types/embedding.py +201 -0
  40. cartesia/environment.py +7 -0
  41. cartesia/infill/__init__.py +2 -0
  42. cartesia/infill/client.py +318 -0
  43. cartesia/tts/__init__.py +167 -0
  44. cartesia/{_async_websocket.py → tts/_async_websocket.py} +212 -85
  45. cartesia/tts/_websocket.py +479 -0
  46. cartesia/tts/client.py +407 -0
  47. cartesia/tts/requests/__init__.py +76 -0
  48. cartesia/tts/requests/cancel_context_request.py +17 -0
  49. cartesia/tts/requests/controls.py +11 -0
  50. cartesia/tts/requests/generation_request.py +58 -0
  51. cartesia/tts/requests/mp_3_output_format.py +11 -0
  52. cartesia/tts/requests/output_format.py +30 -0
  53. cartesia/tts/requests/phoneme_timestamps.py +10 -0
  54. cartesia/tts/requests/raw_output_format.py +11 -0
  55. cartesia/tts/requests/speed.py +7 -0
  56. cartesia/tts/requests/tts_request.py +24 -0
  57. cartesia/tts/requests/tts_request_embedding_specifier.py +16 -0
  58. cartesia/tts/requests/tts_request_id_specifier.py +16 -0
  59. cartesia/tts/requests/tts_request_voice_specifier.py +7 -0
  60. cartesia/tts/requests/wav_output_format.py +7 -0
  61. cartesia/tts/requests/web_socket_base_response.py +11 -0
  62. cartesia/tts/requests/web_socket_chunk_response.py +11 -0
  63. cartesia/tts/requests/web_socket_done_response.py +7 -0
  64. cartesia/tts/requests/web_socket_error_response.py +7 -0
  65. cartesia/tts/requests/web_socket_flush_done_response.py +9 -0
  66. cartesia/tts/requests/web_socket_phoneme_timestamps_response.py +9 -0
  67. cartesia/tts/requests/web_socket_raw_output_format.py +11 -0
  68. cartesia/tts/requests/web_socket_request.py +7 -0
  69. cartesia/tts/requests/web_socket_response.py +70 -0
  70. cartesia/tts/requests/web_socket_stream_options.py +8 -0
  71. cartesia/tts/requests/web_socket_timestamps_response.py +9 -0
  72. cartesia/tts/requests/web_socket_tts_output.py +18 -0
  73. cartesia/tts/requests/web_socket_tts_request.py +25 -0
  74. cartesia/tts/requests/word_timestamps.py +10 -0
  75. cartesia/tts/socket_client.py +302 -0
  76. cartesia/tts/types/__init__.py +90 -0
  77. cartesia/tts/types/cancel_context_request.py +28 -0
  78. cartesia/tts/types/context_id.py +3 -0
  79. cartesia/tts/types/controls.py +22 -0
  80. cartesia/tts/types/emotion.py +34 -0
  81. cartesia/tts/types/flush_id.py +3 -0
  82. cartesia/tts/types/generation_request.py +71 -0
  83. cartesia/tts/types/mp_3_output_format.py +23 -0
  84. cartesia/tts/types/natural_specifier.py +5 -0
  85. cartesia/tts/types/numerical_specifier.py +3 -0
  86. cartesia/tts/types/output_format.py +58 -0
  87. cartesia/tts/types/phoneme_timestamps.py +21 -0
  88. cartesia/tts/types/raw_encoding.py +5 -0
  89. cartesia/tts/types/raw_output_format.py +22 -0
  90. cartesia/tts/types/speed.py +7 -0
  91. cartesia/tts/types/supported_language.py +7 -0
  92. cartesia/tts/types/tts_request.py +35 -0
  93. cartesia/tts/types/tts_request_embedding_specifier.py +27 -0
  94. cartesia/tts/types/tts_request_id_specifier.py +27 -0
  95. cartesia/tts/types/tts_request_voice_specifier.py +7 -0
  96. cartesia/tts/types/wav_output_format.py +17 -0
  97. cartesia/tts/types/web_socket_base_response.py +22 -0
  98. cartesia/tts/types/web_socket_chunk_response.py +22 -0
  99. cartesia/tts/types/web_socket_done_response.py +17 -0
  100. cartesia/tts/types/web_socket_error_response.py +19 -0
  101. cartesia/tts/types/web_socket_flush_done_response.py +21 -0
  102. cartesia/tts/types/web_socket_phoneme_timestamps_response.py +20 -0
  103. cartesia/tts/types/web_socket_raw_output_format.py +22 -0
  104. cartesia/tts/types/web_socket_request.py +7 -0
  105. cartesia/tts/types/web_socket_response.py +125 -0
  106. cartesia/tts/types/web_socket_stream_options.py +19 -0
  107. cartesia/tts/types/web_socket_timestamps_response.py +20 -0
  108. cartesia/tts/types/web_socket_tts_output.py +29 -0
  109. cartesia/tts/types/web_socket_tts_request.py +37 -0
  110. cartesia/tts/types/word_timestamps.py +21 -0
  111. cartesia/{_constants.py → tts/utils/constants.py} +2 -2
  112. cartesia/tts/utils/tts.py +64 -0
  113. cartesia/tts/utils/types.py +70 -0
  114. cartesia/version.py +3 -1
  115. cartesia/voice_changer/__init__.py +27 -0
  116. cartesia/voice_changer/client.py +395 -0
  117. cartesia/voice_changer/requests/__init__.py +15 -0
  118. cartesia/voice_changer/requests/streaming_response.py +38 -0
  119. cartesia/voice_changer/types/__init__.py +17 -0
  120. cartesia/voice_changer/types/output_format_container.py +5 -0
  121. cartesia/voice_changer/types/streaming_response.py +64 -0
  122. cartesia/voices/__init__.py +81 -0
  123. cartesia/voices/client.py +1218 -0
  124. cartesia/voices/requests/__init__.py +29 -0
  125. cartesia/voices/requests/create_voice_request.py +23 -0
  126. cartesia/voices/requests/embedding_response.py +8 -0
  127. cartesia/voices/requests/embedding_specifier.py +10 -0
  128. cartesia/voices/requests/get_voices_response.py +24 -0
  129. cartesia/voices/requests/id_specifier.py +10 -0
  130. cartesia/voices/requests/localize_dialect.py +11 -0
  131. cartesia/voices/requests/localize_voice_request.py +28 -0
  132. cartesia/voices/requests/mix_voice_specifier.py +7 -0
  133. cartesia/voices/requests/mix_voices_request.py +9 -0
  134. cartesia/voices/requests/update_voice_request.py +15 -0
  135. cartesia/voices/requests/voice.py +43 -0
  136. cartesia/voices/requests/voice_metadata.py +36 -0
  137. cartesia/voices/types/__init__.py +53 -0
  138. cartesia/voices/types/base_voice_id.py +5 -0
  139. cartesia/voices/types/clone_mode.py +5 -0
  140. cartesia/voices/types/create_voice_request.py +34 -0
  141. cartesia/voices/types/embedding_response.py +20 -0
  142. cartesia/voices/types/embedding_specifier.py +22 -0
  143. cartesia/voices/types/gender.py +5 -0
  144. cartesia/voices/types/gender_presentation.py +5 -0
  145. cartesia/voices/types/get_voices_response.py +34 -0
  146. cartesia/voices/types/id_specifier.py +22 -0
  147. cartesia/voices/types/localize_dialect.py +11 -0
  148. cartesia/voices/types/localize_english_dialect.py +5 -0
  149. cartesia/voices/types/localize_french_dialect.py +5 -0
  150. cartesia/voices/types/localize_portuguese_dialect.py +5 -0
  151. cartesia/voices/types/localize_spanish_dialect.py +5 -0
  152. cartesia/voices/types/localize_target_language.py +7 -0
  153. cartesia/voices/types/localize_voice_request.py +39 -0
  154. cartesia/voices/types/mix_voice_specifier.py +7 -0
  155. cartesia/voices/types/mix_voices_request.py +20 -0
  156. cartesia/voices/types/update_voice_request.py +27 -0
  157. cartesia/voices/types/voice.py +54 -0
  158. cartesia/voices/types/voice_expand_options.py +5 -0
  159. cartesia/voices/types/voice_id.py +3 -0
  160. cartesia/voices/types/voice_metadata.py +48 -0
  161. cartesia/voices/types/weight.py +3 -0
  162. cartesia-2.0.0.dist-info/METADATA +414 -0
  163. cartesia-2.0.0.dist-info/RECORD +165 -0
  164. {cartesia-1.3.1.dist-info → cartesia-2.0.0.dist-info}/WHEEL +1 -1
  165. cartesia/_async_sse.py +0 -95
  166. cartesia/_logger.py +0 -3
  167. cartesia/_sse.py +0 -143
  168. cartesia/_types.py +0 -70
  169. cartesia/_websocket.py +0 -358
  170. cartesia/async_client.py +0 -82
  171. cartesia/async_tts.py +0 -63
  172. cartesia/resource.py +0 -44
  173. cartesia/tts.py +0 -137
  174. cartesia/utils/deprecated.py +0 -55
  175. cartesia/utils/retry.py +0 -87
  176. cartesia/utils/tts.py +0 -78
  177. cartesia/voices.py +0 -208
  178. cartesia-1.3.1.dist-info/METADATA +0 -661
  179. cartesia-1.3.1.dist-info/RECORD +0 -23
  180. cartesia-1.3.1.dist-info/licenses/LICENSE.md +0 -21
  181. /cartesia/{utils/__init__.py → py.typed} +0 -0
@@ -0,0 +1,165 @@
1
+ cartesia/__init__.py,sha256=k-YMKYUtzKObkF9Zn0TuHTC2_Z07mH6CTnZmn1my7po,8143
2
+ cartesia/api_status/__init__.py,sha256=_dHNLdknrBjxHtU2PvLumttJM-JTQhJQqhhAQkLqt_U,168
3
+ cartesia/api_status/client.py,sha256=GJ9Dq8iCn3hn8vCIqc6k1fCGEhSz0T0kaPGcdFnbMDY,3146
4
+ cartesia/api_status/requests/__init__.py,sha256=ilEMzEy1JEw484CuL92bX5lHGOznc62pjiDMgiZ0tKM,130
5
+ cartesia/api_status/requests/api_info.py,sha256=AmB6RpquI2yUlTQBtOk8e0qtLmXHYLcGZKpXZahOwmc,172
6
+ cartesia/api_status/types/__init__.py,sha256=6NUyGWiGK1Wl3mXlSMJN2ObKf2LK3vjX2MUP1uopfEQ,118
7
+ cartesia/api_status/types/api_info.py,sha256=o1LwSxnoHpCR7huw9J-cF6LRlC_fiftDQLYUz8p-vTc,568
8
+ cartesia/base_client.py,sha256=EIfMrSkJgMCgzYWJ5GN2RxsWikxcH0kMmcb3WYqfQ_g,6321
9
+ cartesia/client.py,sha256=sPAYQLt9W2E_2F17ooocvvJImuNyLrL8xUypgf6dZeI,6238
10
+ cartesia/core/__init__.py,sha256=-t9txgeQZL_1FDw_08GEoj4ft1Cn9Dti6X0Drsadlr0,1519
11
+ cartesia/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
12
+ cartesia/core/client_wrapper.py,sha256=Fpmkc1Tz79KJrbzs3CevKVw3_U9eN8mJyy1RY1hBbj4,1854
13
+ cartesia/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
14
+ cartesia/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
15
+ cartesia/core/http_client.py,sha256=KL5RGa0y4n8nX0-07WRg4ZQUTq30sc-XJbWcP5vjBDg,19552
16
+ cartesia/core/jsonable_encoder.py,sha256=qaF1gtgH-kQZb4kJskETwcCsOPUof-NnYVdszHkb-dM,3656
17
+ cartesia/core/pagination.py,sha256=ykffinbn7c3pXaXLrAlFbSdNbZmJJXoU7VSFIRCLAo0,3177
18
+ cartesia/core/pydantic_utilities.py,sha256=UibVGGYmBDsV834x8CtckRDrTIL4lYJPMrcq9yvf7RM,11973
19
+ cartesia/core/query_encoder.py,sha256=ekulqNd0j8TgD7ox-Qbz7liqX8-KP9blvT9DsRCenYM,2144
20
+ cartesia/core/remove_none_from_dict.py,sha256=EU9SGgYidWq7SexuJbNs4-PZ-5Bl3Vppd864mS6vQZw,342
21
+ cartesia/core/request_options.py,sha256=h0QUNCFVdCW_7GclVySCAY2w4NhtXVBUCmHgmzaxpcg,1681
22
+ cartesia/core/serialization.py,sha256=D9h_t-RQON3-CHWs1C4ESY9B-Yd5d-l5lnTLb_X896g,9601
23
+ cartesia/datasets/__init__.py,sha256=m7uI_lBRsIh-YOIin7Q11cHSXD4FMUkq_J74CLMWuyY,640
24
+ cartesia/datasets/requests/__init__.py,sha256=pxNlVfjSEPr1RfJKb07CXKIrg_EDa4_t8le2x6u9l1c,489
25
+ cartesia/datasets/requests/create_dataset_request.py,sha256=RtISvq-eA8GG_0plEPTkJl8TzOVm93NQuHbJVGtkQeg,169
26
+ cartesia/datasets/requests/dataset.py,sha256=Wxg5AEBh8h9t5N2ud96bsrPVgjH5orMAv1PXl1RGTDs,188
27
+ cartesia/datasets/requests/dataset_file.py,sha256=ddxUw-yYzATfRDn_ey-SzSYd_2J501OsAggH13sbIRE,196
28
+ cartesia/datasets/requests/paginated_dataset_files.py,sha256=6hZm3O8qJSkinqdJLSgEPaKBi2Vx3NxfTKk1FGwA2e0,278
29
+ cartesia/datasets/requests/paginated_datasets.py,sha256=UHzcmKJ73pOtN-CUfQurHCb0y6yf1hNGum3ckbn83YY,261
30
+ cartesia/datasets/types/__init__.py,sha256=cDPaVpLq8O6I6mWuuVGZOICgO9_Os2BXPWEAK1hbHsg,486
31
+ cartesia/datasets/types/create_dataset_request.py,sha256=w9-7U1gcW67tcticQ9zteYga3Vc_LPUfISttLc_-06o,565
32
+ cartesia/datasets/types/dataset.py,sha256=uR_tSITVL_G2lYqMZIhPGddgmaUbqsifZ5eXpbt-pOE,584
33
+ cartesia/datasets/types/dataset_file.py,sha256=VuKeojvfl112AZzN3qmMiI3P_oeNXq84U4dAIfuwY3c,592
34
+ cartesia/datasets/types/file_purpose.py,sha256=YfhGIUTJsQedSf6lnBU-jSz_h9xEpVVtOyYnyHNtcaQ,148
35
+ cartesia/datasets/types/paginated_dataset_files.py,sha256=xY2XiXvcLqt5nPQIIPuIwBtPeM0_0sVYxc5MshFh5j8,644
36
+ cartesia/datasets/types/paginated_datasets.py,sha256=bNgCtzFC3EPqAc0bd9nvkKtR4Q8CwJNpVUr0BBpQJkE,627
37
+ cartesia/embedding/__init__.py,sha256=mfTGlVbrByIrk4KTsZeNCNfm2qYUu1dcO_o37eEgPik,119
38
+ cartesia/embedding/types/__init__.py,sha256=aOrEOGuiO6dlSGu7pckqVMTYEMVAR5I7qqcairy0vlA,123
39
+ cartesia/embedding/types/embedding.py,sha256=C1OJg8M4T1Apfcv4qx79ndftg0SgH4Lfqe_iU3UF-bA,1851
40
+ cartesia/environment.py,sha256=Qnp91BGLic7hXmKsiYub2m3nPfvDWm59aB1wWta1J6A,160
41
+ cartesia/infill/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
42
+ cartesia/infill/client.py,sha256=PWE5Ak-wsaBM_8g52oDl9PYx76PkW6f900mnxvZf4Bk,12571
43
+ cartesia/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
+ cartesia/tts/__init__.py,sha256=G0wcYlPrr7hmu5DQgCG7bDTQq36fpP3iBM5164Z0-Js,4701
45
+ cartesia/tts/_async_websocket.py,sha256=U7ySTJqb3V0RDSKPcFfzpBa0pqui05k5BTqiIpSBth0,18652
46
+ cartesia/tts/_websocket.py,sha256=roMJ7oDSjr5U5sTHM8EcGu-EtzbIVUH4HmOY1yI2JL4,19118
47
+ cartesia/tts/client.py,sha256=KMhDaW0gG_uwkSq1EzoC-bCx1G0TLB4K4Gm57L4xDSs,14832
48
+ cartesia/tts/requests/__init__.py,sha256=0rcfMLHNbUhkRI1xS09UE4p-WT1BCqrcblFtPxcATOI,3261
49
+ cartesia/tts/requests/cancel_context_request.py,sha256=Wl8g-o5vwl9ENm-H1wsLx441FkIR_4Wt5UYtuWce2Yw,431
50
+ cartesia/tts/requests/controls.py,sha256=xzUJlfgqhaJ1A-JD0LTpoHYk4iEpCuGpSD7qE4YYsRg,285
51
+ cartesia/tts/requests/generation_request.py,sha256=D7eB1HEOzoGbviMavtK1hwsP0lTO7K-pEs3UQIAZpDs,1980
52
+ cartesia/tts/requests/mp_3_output_format.py,sha256=PGDVzC1d7-Jce12rFxtF8G1pTHmlUdiGAhykFTABg0w,316
53
+ cartesia/tts/requests/output_format.py,sha256=8TKu9AAeHCR5L4edzYch8FIYIldn4bM7ySrsCl8W_g8,842
54
+ cartesia/tts/requests/phoneme_timestamps.py,sha256=ft81nmqElZAnvTBT27lY6YWfF18ZGsCx3Y1XHv9J7cM,267
55
+ cartesia/tts/requests/raw_output_format.py,sha256=S60Vp7DeAATCMLF3bXgxhw0zILJBWJ9GhI9irAg_UkI,316
56
+ cartesia/tts/requests/speed.py,sha256=-YGBWwh7_VtCBnYlT5EVsnrmcHFMEBTxy9LathZhkMA,259
57
+ cartesia/tts/requests/tts_request.py,sha256=rh7akZLf_w0RukKclCic9fKIIJi-X1M1GeHnJ14rjKk,921
58
+ cartesia/tts/requests/tts_request_embedding_specifier.py,sha256=-M54ZjV0H5LPwcKtz0bOVqlkvO1pPiMbqMbVBMko3Ns,565
59
+ cartesia/tts/requests/tts_request_id_specifier.py,sha256=-0ClfyJnnaH0uAcF5r84s3cM_cw2wT39dp6T4JYzOQ8,536
60
+ cartesia/tts/requests/tts_request_voice_specifier.py,sha256=eGzL4aVGq4gKPxeglsV7-wuhxg8x33Qth3uFTTytgeI,337
61
+ cartesia/tts/requests/wav_output_format.py,sha256=qiipmT5hWsa8J-fwW1EH_rnUAX_zOUpGJUNzuLc65r4,181
62
+ cartesia/tts/requests/web_socket_base_response.py,sha256=zCjHw-FaNJMOcHiAb2NQWrBBfrzU5rc95vqDp7y9RmA,315
63
+ cartesia/tts/requests/web_socket_chunk_response.py,sha256=uuwLYBhxDCUfg21oFmrY5BXnRqiwpLlW-yY_4dyN9SQ,348
64
+ cartesia/tts/requests/web_socket_done_response.py,sha256=YLHrT6NkmDntBSxF-JGlXSavdlOWo_cb9tGKCVivGH4,206
65
+ cartesia/tts/requests/web_socket_error_response.py,sha256=ek2O5Whlzn5Ma40NhYviVl3aJBVeCA8BBvbJPUYxEiQ,213
66
+ cartesia/tts/requests/web_socket_flush_done_response.py,sha256=gP3fSWhEFVzdzBweUmVKo7JvdREW3TM9R6o9-u6V6FQ,282
67
+ cartesia/tts/requests/web_socket_phoneme_timestamps_response.py,sha256=nDRK7wo4s6R7ayJrw-LJX9WCaW4mti0HAV4X5j7cxjI,370
68
+ cartesia/tts/requests/web_socket_raw_output_format.py,sha256=9BJHE5l5bzmYCYuUoACRhbZdJBijnSiwkbR8K4EzPDY,302
69
+ cartesia/tts/requests/web_socket_request.py,sha256=5xfE0NgkBEZdus_vC-3RVQkuqhNmXHxLMX4DW3ezcKc,290
70
+ cartesia/tts/requests/web_socket_response.py,sha256=WqZ6RgO4suG78wiVSIsOWwyXBioV1QiEiiPCP_T7HHw,2132
71
+ cartesia/tts/requests/web_socket_stream_options.py,sha256=VIvblFw9hGZvDzFpOnC11G0NvrFSVt-1-0sY5rpcZPI,232
72
+ cartesia/tts/requests/web_socket_timestamps_response.py,sha256=MK3zN2Q_PVWJtX5DidNB0uXoF2o33rv6qCYPVaourxY,351
73
+ cartesia/tts/requests/web_socket_tts_output.py,sha256=pX2uf0XVdziFhXCydwLlVOWb-LvBiuq-cBI6R1INiMg,760
74
+ cartesia/tts/requests/web_socket_tts_request.py,sha256=jv8EYSxsjb063uzKjybRRNusmNtfzt516-r2urfG-vU,1101
75
+ cartesia/tts/requests/word_timestamps.py,sha256=WMfBJtETi6wTpES0pYZCFfFRfEbzWE-RtosDJ5seUWg,261
76
+ cartesia/tts/socket_client.py,sha256=zTPayHbgy-yQQ50AE1HXN4GMyanisZcLXf7Ds1paYks,11621
77
+ cartesia/tts/types/__init__.py,sha256=yV_-DY9EPNAFEfuIk3wgRLcc4Ta5igv0T5g-IIQ53v0,3251
78
+ cartesia/tts/types/cancel_context_request.py,sha256=zInhk3qRZsSc0F1aYJ-Q5BHJsosTrb22IJWhzue-eKE,856
79
+ cartesia/tts/types/context_id.py,sha256=UCEtq5xFGOeBCECcY6Y-gYVe_Peg1hFhH9YYOkpApQg,81
80
+ cartesia/tts/types/controls.py,sha256=H4CSu79mM1Ld4NZx_5uXw3EwRzTEMQRxKBRvFpcFb8Y,644
81
+ cartesia/tts/types/emotion.py,sha256=zocyDcHTiFFnNRgo2YLMi70iGyffa080B4mkg9lcqVc,764
82
+ cartesia/tts/types/flush_id.py,sha256=HCIKo9o8d7YWKtaSNU3TEvfUVBju93ckGQy01Z9wLcE,79
83
+ cartesia/tts/types/generation_request.py,sha256=Ig14IIulKgsHtIoRmfrov-U0jpYWQqOjCAUt5Fk20z4,2476
84
+ cartesia/tts/types/mp_3_output_format.py,sha256=0WGblkuDUL7pZO1aRuQ_mU2Z5gN9xIabRfRKkjtzms8,731
85
+ cartesia/tts/types/natural_specifier.py,sha256=K526P1RRuBGy80hyd_tX8tohPrE8DR9EgTCxS5wce0o,188
86
+ cartesia/tts/types/numerical_specifier.py,sha256=tJpIskWO545luCKMFM9JlVc7VVhBhSvqL1qurhzL9cI,92
87
+ cartesia/tts/types/output_format.py,sha256=bi9iZVQKmddTw6RjNKG9XAVrgEB7JVNsBS_emFLlGLs,1736
88
+ cartesia/tts/types/phoneme_timestamps.py,sha256=SrhPmE7-1-bCVi4qCgMU7QR9ezkwUfqsWfZ2PchzwN0,637
89
+ cartesia/tts/types/raw_encoding.py,sha256=eyc2goiYOTxWcuKHAgYZ2SrnfePW22Fbmc-5fGPlV2Y,186
90
+ cartesia/tts/types/raw_output_format.py,sha256=jZGVaS0KIi9mU6trfskgA3HbMKJolhrwICnuDhF01ic,673
91
+ cartesia/tts/types/speed.py,sha256=4c5WdxocBw6WSMnundSaNnceUeooU0vikhy00FW6M-w,239
92
+ cartesia/tts/types/supported_language.py,sha256=riDRduThMbMWAq9i2uCfxhwVTpgaFwNDZ9LhEIl4zHY,237
93
+ cartesia/tts/types/tts_request.py,sha256=MxWcMLxIpotkPiPhFIhdHTtDzYv8yzLJwrwX3kBhkIg,1290
94
+ cartesia/tts/types/tts_request_embedding_specifier.py,sha256=eL_qCEr4pvWfy4qp9hZBuVdCincX5DBVqfv1vLt2_Vk,942
95
+ cartesia/tts/types/tts_request_id_specifier.py,sha256=ktGdkkTRQ9scA-lt8qJ2jn_E5WzoOK8AXMrVqi71gf0,906
96
+ cartesia/tts/types/tts_request_voice_specifier.py,sha256=p-3UQ62uFL1SgbX73Ex1D_V73Ef0wmT1ApOt1iLZmwE,307
97
+ cartesia/tts/types/wav_output_format.py,sha256=OTAgVn_gBMk252XO12kiNI9lKrbw3n38aBAiqlG5mdU,531
98
+ cartesia/tts/types/web_socket_base_response.py,sha256=MWoTt1rGRqUQ8BOad1Zk2SA-i0E8a3JwPLSiehIbFj4,672
99
+ cartesia/tts/types/web_socket_chunk_response.py,sha256=dRyk06cuqpV88kSNb4X1MPEsi9v_YvoQ0AbdJDBsykI,669
100
+ cartesia/tts/types/web_socket_done_response.py,sha256=zZ6V-_pKNifdyuuRHGlZe6Zbc-ZRk-uHk5zgHkZcBEw,556
101
+ cartesia/tts/types/web_socket_error_response.py,sha256=Jm26GnK0axyLQI3-JLHC0buYVIU8gKWxLAJlzo-cJFQ,573
102
+ cartesia/tts/types/web_socket_flush_done_response.py,sha256=JLiVPDftr1arl_Kvj6038yj0mnjq6x0ooihsbdXajfw,635
103
+ cartesia/tts/types/web_socket_phoneme_timestamps_response.py,sha256=R1-Z_W3XF7L7rrPwEOK_EfXHT4FWRpSAX3g71WebM90,686
104
+ cartesia/tts/types/web_socket_raw_output_format.py,sha256=9PiOVmPDfT32IDIsmU7UY_rTLOShMMEw1pNv2yZ9Kyg,685
105
+ cartesia/tts/types/web_socket_request.py,sha256=_xoAShkCCNTVAWKCvHw5k0Wisq60y4fOWYjG7SA8edM,260
106
+ cartesia/tts/types/web_socket_response.py,sha256=mHDECZ4K84QmN2s0IWuBsXBt83Yq7QxHnolwszIyoYs,3823
107
+ cartesia/tts/types/web_socket_stream_options.py,sha256=MhDSxBFqMuQeWjoyPqXVnTEzLjF8g6aojeigb5dQUgU,596
108
+ cartesia/tts/types/web_socket_timestamps_response.py,sha256=kuWXI82ncF1QapnaHEjwrL84qWob7ByQU-yh1e0IEmk,667
109
+ cartesia/tts/types/web_socket_tts_output.py,sha256=uvkv0smTBhdm18Rl17C0Ml4Inh79YBHNzAcKnZBs14Y,979
110
+ cartesia/tts/types/web_socket_tts_request.py,sha256=4qp-mPmVZOMlHAr7f8ABMWYS3cy5OWPjxDNeWayU0aE,1429
111
+ cartesia/tts/types/word_timestamps.py,sha256=XZ2Q0prdb3F9c3AiOKXu4s3A3jBxE-qIt1npHOf16R0,631
112
+ cartesia/tts/utils/constants.py,sha256=1CHa5flJf8--L_eYyOyOiWJNZ-Q81ufHZxDbJs8xYSk,418
113
+ cartesia/tts/utils/tts.py,sha256=u7PgPxlJs6fcQTfr-jqAvBCAaK3JWLhF5QF4s-PwoMo,2093
114
+ cartesia/tts/utils/types.py,sha256=DtsiRwrYypXScLu71gNyprUiELuR1l_-ikVaj47gpg4,2047
115
+ cartesia/version.py,sha256=xk5z2FYkgnvzyjqzmRg67rYl8fnCeHEjPpVmD08bjyE,75
116
+ cartesia/voice_changer/__init__.py,sha256=UKA8CSAwUb41OL-dcWWUhIsKLLsyY_NQtrklPAVWf9E,685
117
+ cartesia/voice_changer/client.py,sha256=vvyEbjwBhC-iS09nkmITMl81lNfrVxef3neUADyv-xc,13517
118
+ cartesia/voice_changer/requests/__init__.py,sha256=MRwSUqio3mg_tvfcpAS0wIZ69HvJsc2kYJ0tUBaJ53U,390
119
+ cartesia/voice_changer/requests/streaming_response.py,sha256=cV6L9mMY0w2JpJ0xKoFw2OSiN30xI9W2HLmoU1FE6i0,1077
120
+ cartesia/voice_changer/types/__init__.py,sha256=qAiHsdRpnFeS0lBkYp_NRrhSJiRXCg5-uFibqDWzYVU,430
121
+ cartesia/voice_changer/types/output_format_container.py,sha256=RqLDELdgeOjYqNTJX1Le62qjiFiJGxf0cYnol88-LLM,166
122
+ cartesia/voice_changer/types/streaming_response.py,sha256=rQ4ZehtOHsCBKijyULz_ahGQYNj1yus6AM6u2wgcBsI,1963
123
+ cartesia/voices/__init__.py,sha256=2D58Bir45LvcvP08QMnPlFE8DD8BONTjPLkIDdKs7vg,1891
124
+ cartesia/voices/client.py,sha256=8zQZAtaCAJi79puMxVhzR5OWCDjows53k4oTvSgcdJM,38867
125
+ cartesia/voices/requests/__init__.py,sha256=XiBJbSYeQCgFMtwywKvQ0Nmp7Zf_0WskzRhgr9c8h38,1072
126
+ cartesia/voices/requests/create_voice_request.py,sha256=r6dKb9ga0ZsAi_6PXuE43u2lLgfQg2DIYjk2Neng7pI,617
127
+ cartesia/voices/requests/embedding_response.py,sha256=PGZkBD8UBcv2MYQbBXyD4T6lzaE9oSGGwXx-MoXCp0M,228
128
+ cartesia/voices/requests/embedding_specifier.py,sha256=PAHdGsVmLLeJC2b1fWHWI_OlhogO1WnJdzoX9pj5N8c,282
129
+ cartesia/voices/requests/get_voices_response.py,sha256=g-ZCaCaLOlZSitcKVhdCtfdKQQz8N3W6E7_wZUNOi5M,747
130
+ cartesia/voices/requests/id_specifier.py,sha256=UTtoXBEEYaGvg-Dn2QxUDACNB3Vm1O1XbrPtBA3rGzU,252
131
+ cartesia/voices/requests/localize_dialect.py,sha256=OHAInU6IP0LBzIY3VYSiU9bRLjXfr1pGXunsLgv1QHs,497
132
+ cartesia/voices/requests/localize_voice_request.py,sha256=oh828eqYkiticD_lerc8WemN3bW13mLZpfRDiKbG75g,703
133
+ cartesia/voices/requests/mix_voice_specifier.py,sha256=YjOJ2Qt3nqMQzHsYbF1DnZgmZS9zZepLXpji6V9mfgs,266
134
+ cartesia/voices/requests/mix_voices_request.py,sha256=6JCzFmWKIS1_t-uSoO1m-FQbLWB1zaykTcGV-1s-RqM,275
135
+ cartesia/voices/requests/update_voice_request.py,sha256=XxJ6TKO4M2s1kXQAZRj8uA4okIABvmWiFhAHJv4BS0Q,282
136
+ cartesia/voices/requests/voice.py,sha256=M-4lf4W57fx84_JFOy55b9mWcqO4LfzpY-G_Ekv-2Bo,1031
137
+ cartesia/voices/requests/voice_metadata.py,sha256=S0jPQtBpEb2WSnYDLQTS7pcbNJpc0d01uWravHaqzso,697
138
+ cartesia/voices/types/__init__.py,sha256=yjxMWjoBpwAZ5UJ2iRSC_kKgZvGmqVd09kQxgcTnMac,1782
139
+ cartesia/voices/types/base_voice_id.py,sha256=nWRC0rvLpjeMpRbLSmUTPziWo1ZrbPxw22l4gEBWp8Q,118
140
+ cartesia/voices/types/clone_mode.py,sha256=3sR6wdxym4xDVsoHppp3-V9mpDwP9F9fDfMUQKG24xw,160
141
+ cartesia/voices/types/create_voice_request.py,sha256=_q0d8QojmQrpU-Puzd_YvWmiC7cBp_lrbKmTLuknYqQ,1005
142
+ cartesia/voices/types/embedding_response.py,sha256=B7MJ79HIAnxtiP6OT0tt27KBDYTZ3VU0MLuQfb5qVOg,624
143
+ cartesia/voices/types/embedding_specifier.py,sha256=cf6JfVnISyrvjWup3oAg-RFdMVRxytem6HLwZgKl3gA,671
144
+ cartesia/voices/types/gender.py,sha256=OrbTO__3HVNculvkcb5Pz-Yoa-Xv8N_rNMrFoy2DoaA,148
145
+ cartesia/voices/types/gender_presentation.py,sha256=rM8pSurYCSH0AGgLsVpVAPp7uz7TQMM1nPa7-Vus7gw,185
146
+ cartesia/voices/types/get_voices_response.py,sha256=c6KMkmJepTUmT7I6tAVOGrPst2kkXxDCXLIf1AnR9NE,1136
147
+ cartesia/voices/types/id_specifier.py,sha256=yAY-uc9hRJkHXdsSfRZWkE8ga2Sb-KVipOTSXa8Wmp0,634
148
+ cartesia/voices/types/localize_dialect.py,sha256=6JpJKeQvtDjCT2n-5yaGOe3D-4nYqUoYrvcCSE2Zxik,463
149
+ cartesia/voices/types/localize_english_dialect.py,sha256=0PjZNjQv5ll2wWZxGveQIYCUGLtGDVELK9FBWFe7SNc,176
150
+ cartesia/voices/types/localize_french_dialect.py,sha256=aMhqLi_5goAaSGZguZIFOwQ9Yqh5ApL6gS3cDI315lQ,157
151
+ cartesia/voices/types/localize_portuguese_dialect.py,sha256=6dcThK1qWyS3c-W--3Zz7HK5ixS0qslEWrVQmKSrl9E,161
152
+ cartesia/voices/types/localize_spanish_dialect.py,sha256=h-H52vk0MBOvJqlzPVPgajfQU6oxpTzHoQAKmSDyaC4,158
153
+ cartesia/voices/types/localize_target_language.py,sha256=ttngtFVpMvuWAKQztJu_pCaf7V62DzmNq9zthPCb2LI,242
154
+ cartesia/voices/types/localize_voice_request.py,sha256=gvjg292kMgji0L9TNO3VqDS0pHO1vGJUcf0l_vEW_5Y,1098
155
+ cartesia/voices/types/mix_voice_specifier.py,sha256=B0FE6UREGk1TxlN0GOPwyCuqJbMkWVUs0EFqiJuQfZ8,236
156
+ cartesia/voices/types/mix_voices_request.py,sha256=R_8bmUmE1br4wmfH1Qu6EnL9uC-V1z5BV3_B7u51EOw,641
157
+ cartesia/voices/types/update_voice_request.py,sha256=_CEH8nuSZn2qZa9xZlANZXOhJd49XLel3dRy2dfOvr8,716
158
+ cartesia/voices/types/voice.py,sha256=DnJbBs2aX4JGZOxm0V4VSTsy1ijw42QKqpaEScL3Lak,1505
159
+ cartesia/voices/types/voice_expand_options.py,sha256=e4FroWdlxEE-LXQfT1RWlGHtswl8bmXaLMr3xza1fMk,169
160
+ cartesia/voices/types/voice_id.py,sha256=GDoXcRVeIm-V21R4suxG2zqLD3DLYkXE9kgizadzFKo,79
161
+ cartesia/voices/types/voice_metadata.py,sha256=4KNGjXMUKm3niv-NvKIFVGtiilpH13heuzKcZYNQxk4,1181
162
+ cartesia/voices/types/weight.py,sha256=XqDU7_JItNUb5QykIDqTbELlRYQdbt2SviRgW0w2LKo,80
163
+ cartesia-2.0.0.dist-info/METADATA,sha256=ZquhZ9XMhW2QPnwHc4XBnVrOfuvaJq3uXCyRyaXwjQo,11206
164
+ cartesia-2.0.0.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
165
+ cartesia-2.0.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.3
2
+ Generator: poetry-core 1.6.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
cartesia/_async_sse.py DELETED
@@ -1,95 +0,0 @@
1
- import base64
2
- import json
3
- from typing import Any, AsyncGenerator, Callable, Dict, List, Optional, Union
4
-
5
- import aiohttp
6
-
7
- from cartesia._constants import BACKOFF_FACTOR, MAX_RETRIES
8
- from cartesia._logger import logger
9
- from cartesia._sse import _SSE
10
- from cartesia._types import OutputFormat, VoiceControls
11
- from cartesia.utils.retry import retry_on_connection_error_async
12
- from cartesia.utils.tts import _construct_tts_request
13
-
14
-
15
- class _AsyncSSE(_SSE):
16
- """This class contains methods to generate audio using Server-Sent Events asynchronously."""
17
-
18
- def __init__(
19
- self,
20
- http_url: str,
21
- headers: Dict[str, str],
22
- timeout: float,
23
- get_session: Callable[[], Optional[aiohttp.ClientSession]],
24
- ):
25
- super().__init__(http_url, headers, timeout)
26
- self._get_session = get_session
27
-
28
- async def send(
29
- self,
30
- model_id: str,
31
- transcript: str,
32
- output_format: OutputFormat,
33
- voice_id: Optional[str] = None,
34
- voice_embedding: Optional[List[float]] = None,
35
- duration: Optional[int] = None,
36
- language: Optional[str] = None,
37
- stream: bool = True,
38
- _experimental_voice_controls: Optional[VoiceControls] = None,
39
- ) -> Union[bytes, AsyncGenerator[bytes, None]]:
40
- request_body = _construct_tts_request(
41
- model_id=model_id,
42
- transcript=transcript,
43
- output_format=output_format,
44
- voice_id=voice_id,
45
- voice_embedding=voice_embedding,
46
- duration=duration,
47
- language=language,
48
- _experimental_voice_controls=_experimental_voice_controls,
49
- )
50
-
51
- generator = self._sse_generator_wrapper(request_body)
52
-
53
- if stream:
54
- return generator
55
-
56
- chunks = []
57
- async for chunk in generator:
58
- chunks.append(chunk["audio"])
59
-
60
- return {"audio": b"".join(chunks)}
61
-
62
- @retry_on_connection_error_async(
63
- max_retries=MAX_RETRIES, backoff_factor=BACKOFF_FACTOR, logger=logger
64
- )
65
- async def _sse_generator_wrapper(self, request_body: Dict[str, Any]):
66
- """Need to wrap the sse generator in a function for the retry decorator to work."""
67
- try:
68
- async for chunk in self._sse_generator(request_body):
69
- yield chunk
70
- except Exception as e:
71
- raise RuntimeError(f"Error generating audio. {e}")
72
-
73
- async def _sse_generator(self, request_body: Dict[str, Any]):
74
- session = await self._get_session()
75
- async with session.post(
76
- f"{self.http_url}/tts/sse",
77
- data=json.dumps(request_body),
78
- headers=self.headers,
79
- ) as response:
80
- if not response.ok:
81
- raise ValueError(f"Failed to generate audio. {await response.text()}")
82
-
83
- buffer = ""
84
- async for chunk_bytes in response.content.iter_any():
85
- buffer, outputs = self._update_buffer(buffer=buffer, chunk_bytes=chunk_bytes)
86
- for output in outputs:
87
- yield output
88
-
89
- if buffer:
90
- try:
91
- chunk_json = json.loads(buffer)
92
- audio = base64.b64decode(chunk_json["data"])
93
- yield {"audio": audio}
94
- except json.JSONDecodeError:
95
- pass
cartesia/_logger.py DELETED
@@ -1,3 +0,0 @@
1
- import logging
2
-
3
- logger = logging.getLogger(__name__)
cartesia/_sse.py DELETED
@@ -1,143 +0,0 @@
1
- import base64
2
- import json
3
- from typing import Any, Dict, Generator, List, Optional, Tuple, Union
4
-
5
- import requests
6
-
7
- from cartesia._constants import BACKOFF_FACTOR, MAX_RETRIES
8
- from cartesia._logger import logger
9
- from cartesia._types import OutputFormat, VoiceControls
10
- from cartesia.utils.retry import retry_on_connection_error
11
- from cartesia.utils.tts import _construct_tts_request, _validate_and_construct_voice
12
-
13
-
14
- class _SSE:
15
- """This class contains methods to generate audio using Server-Sent Events.
16
-
17
- Usage:
18
- >>> for audio_chunk in client.tts.sse(
19
- ... model_id="sonic-english", transcript="Hello world!", voice_embedding=embedding,
20
- ... output_format={"container": "raw", "encoding": "pcm_f32le", "sample_rate": 44100}, stream=True
21
- ... ):
22
- ... audio = audio_chunk["audio"]
23
- """
24
-
25
- def __init__(
26
- self,
27
- http_url: str,
28
- headers: Dict[str, str],
29
- timeout: float,
30
- ):
31
- self.http_url = http_url
32
- self.headers = headers
33
- self.timeout = timeout
34
-
35
- def _update_buffer(self, buffer: str, chunk_bytes: bytes) -> Tuple[str, List[Dict[str, Any]]]:
36
- buffer += chunk_bytes.decode("utf-8")
37
- outputs = []
38
- while "{" in buffer and "}" in buffer:
39
- start_index = buffer.find("{")
40
- end_index = buffer.find("}", start_index)
41
- if start_index != -1 and end_index != -1:
42
- try:
43
- chunk_json = json.loads(buffer[start_index : end_index + 1])
44
- if "error" in chunk_json:
45
- raise RuntimeError(f"Error generating audio:\n{chunk_json['error']}")
46
- if chunk_json["done"]:
47
- break
48
- audio = base64.b64decode(chunk_json["data"])
49
- outputs.append({"audio": audio})
50
- buffer = buffer[end_index + 1 :]
51
- except json.JSONDecodeError:
52
- break
53
- return buffer, outputs
54
-
55
- def send(
56
- self,
57
- model_id: str,
58
- transcript: str,
59
- output_format: OutputFormat,
60
- voice_id: Optional[str] = None,
61
- voice_embedding: Optional[List[float]] = None,
62
- duration: Optional[int] = None,
63
- language: Optional[str] = None,
64
- stream: bool = True,
65
- _experimental_voice_controls: Optional[VoiceControls] = None,
66
- ) -> Union[bytes, Generator[bytes, None, None]]:
67
- """Send a request to the server to generate audio using Server-Sent Events.
68
-
69
- Args:
70
- model_id: The ID of the model to use for generating audio.
71
- transcript: The text to convert to speech.
72
- voice_id: The ID of the voice to use for generating audio.
73
- voice_embedding: The embedding of the voice to use for generating audio.
74
- output_format: A dictionary containing the details of the output format.
75
- duration: The duration of the audio in seconds.
76
- language: The language code for the audio request. This can only be used with `model_id = sonic-multilingual`
77
- stream: Whether to stream the audio or not.
78
- _experimental_voice_controls: Experimental voice controls for controlling speed and emotion.
79
- Note: This is an experimental feature and may change rapidly in future releases.
80
-
81
- Returns:
82
- If `stream` is True, the method returns a generator that yields chunks. Each chunk is a dictionary.
83
- If `stream` is False, the method returns a dictionary.
84
- Both the generator and the dictionary contain the following key(s):
85
- - audio: The audio as bytes.
86
- """
87
- request_body = _construct_tts_request(
88
- model_id=model_id,
89
- transcript=transcript,
90
- output_format=output_format,
91
- voice_id=voice_id,
92
- voice_embedding=voice_embedding,
93
- duration=duration,
94
- language=language,
95
- _experimental_voice_controls=_experimental_voice_controls,
96
- )
97
-
98
- generator = self._sse_generator_wrapper(request_body)
99
-
100
- if stream:
101
- return generator
102
-
103
- chunks = []
104
- for chunk in generator:
105
- chunks.append(chunk["audio"])
106
-
107
- return {"audio": b"".join(chunks)}
108
-
109
- @retry_on_connection_error(
110
- max_retries=MAX_RETRIES, backoff_factor=BACKOFF_FACTOR, logger=logger
111
- )
112
- def _sse_generator_wrapper(self, request_body: Dict[str, Any]):
113
- """Need to wrap the sse generator in a function for the retry decorator to work."""
114
- try:
115
- for chunk in self._sse_generator(request_body):
116
- yield chunk
117
- except Exception as e:
118
- raise RuntimeError(f"Error generating audio. {e}")
119
-
120
- def _sse_generator(self, request_body: Dict[str, Any]):
121
- response = requests.post(
122
- f"{self.http_url}/tts/sse",
123
- stream=True,
124
- data=json.dumps(request_body),
125
- headers=self.headers,
126
- timeout=(self.timeout, self.timeout),
127
- )
128
- if not response.ok:
129
- raise ValueError(f"Failed to generate audio. {response.text}")
130
-
131
- buffer = ""
132
- for chunk_bytes in response.iter_content(chunk_size=None):
133
- buffer, outputs = self._update_buffer(buffer=buffer, chunk_bytes=chunk_bytes)
134
- for output in outputs:
135
- yield output
136
-
137
- if buffer:
138
- try:
139
- chunk_json = json.loads(buffer)
140
- audio = base64.b64decode(chunk_json["data"])
141
- yield {"audio": audio}
142
- except json.JSONDecodeError:
143
- pass
cartesia/_types.py DELETED
@@ -1,70 +0,0 @@
1
- from typing import List, Optional, TypedDict, Union
2
-
3
- from cartesia.utils.deprecated import deprecated
4
-
5
-
6
- class OutputFormatMapping:
7
- _format_mapping = {
8
- "raw_pcm_f32le_44100": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 44100},
9
- "raw_pcm_s16le_44100": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 44100},
10
- "raw_pcm_f32le_24000": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 24000},
11
- "raw_pcm_s16le_24000": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 24000},
12
- "raw_pcm_f32le_22050": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 22050},
13
- "raw_pcm_s16le_22050": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 22050},
14
- "raw_pcm_f32le_16000": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 16000},
15
- "raw_pcm_s16le_16000": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 16000},
16
- "raw_pcm_f32le_8000": {"container": "raw", "encoding": "pcm_f32le", "sample_rate": 8000},
17
- "raw_pcm_s16le_8000": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 8000},
18
- "raw_pcm_mulaw_8000": {"container": "raw", "encoding": "pcm_mulaw", "sample_rate": 8000},
19
- "raw_pcm_alaw_8000": {"container": "raw", "encoding": "pcm_alaw", "sample_rate": 8000},
20
- }
21
-
22
- @classmethod
23
- def get_format(cls, format_name):
24
- if format_name in cls._format_mapping:
25
- return cls._format_mapping[format_name]
26
- else:
27
- raise ValueError(f"Unsupported format: {format_name}")
28
-
29
-
30
- class VoiceMetadata(TypedDict):
31
- id: str
32
- name: str
33
- description: str
34
- embedding: List[float]
35
- is_public: bool
36
- user_id: str
37
- created_at: str
38
- language: str
39
- base_voice_id: Optional[str] = None
40
-
41
-
42
- class VoiceControls(TypedDict):
43
- """Defines different voice control parameters for voice synthesis.
44
-
45
- For a complete list of supported parameters, refer to the Cartesia API documentation.
46
- https://docs.cartesia.ai/reference/api-reference
47
-
48
- Examples:
49
- >>> {"speed": "fastest"}
50
- >>> {"speed": "slow", "emotion": ["sadness:high"]}
51
- >>> {"emotion": ["surprise:highest", "curiosity"]}
52
-
53
- Note:
54
- This is an experimental class and is subject to rapid change in future versions.
55
- """
56
-
57
- speed: Union[str, float] = ""
58
- emotion: List[str] = []
59
-
60
-
61
- class OutputFormat(TypedDict):
62
- container: str
63
- encoding: str
64
- sample_rate: int
65
-
66
-
67
- class EventType:
68
- NULL = ""
69
- AUDIO = "chunk"
70
- TIMESTAMPS = "timestamps"