camb-sdk 1.5.1__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.
Files changed (177) hide show
  1. camb_sdk-1.5.1/LICENSE +21 -0
  2. camb_sdk-1.5.1/PKG-INFO +220 -0
  3. camb_sdk-1.5.1/README.md +201 -0
  4. camb_sdk-1.5.1/camb/__init__.py +335 -0
  5. camb_sdk-1.5.1/camb/audio_separation/__init__.py +4 -0
  6. camb_sdk-1.5.1/camb/audio_separation/client.py +406 -0
  7. camb_sdk-1.5.1/camb/audio_separation/raw_client.py +534 -0
  8. camb_sdk-1.5.1/camb/client.py +721 -0
  9. camb_sdk-1.5.1/camb/core/__init__.py +105 -0
  10. camb_sdk-1.5.1/camb/core/api_error.py +23 -0
  11. camb_sdk-1.5.1/camb/core/client_wrapper.py +85 -0
  12. camb_sdk-1.5.1/camb/core/datetime_utils.py +28 -0
  13. camb_sdk-1.5.1/camb/core/file.py +67 -0
  14. camb_sdk-1.5.1/camb/core/force_multipart.py +18 -0
  15. camb_sdk-1.5.1/camb/core/http_client.py +663 -0
  16. camb_sdk-1.5.1/camb/core/http_response.py +55 -0
  17. camb_sdk-1.5.1/camb/core/http_sse/__init__.py +42 -0
  18. camb_sdk-1.5.1/camb/core/http_sse/_api.py +112 -0
  19. camb_sdk-1.5.1/camb/core/http_sse/_decoders.py +61 -0
  20. camb_sdk-1.5.1/camb/core/http_sse/_exceptions.py +7 -0
  21. camb_sdk-1.5.1/camb/core/http_sse/_models.py +17 -0
  22. camb_sdk-1.5.1/camb/core/jsonable_encoder.py +100 -0
  23. camb_sdk-1.5.1/camb/core/pydantic_utilities.py +260 -0
  24. camb_sdk-1.5.1/camb/core/query_encoder.py +58 -0
  25. camb_sdk-1.5.1/camb/core/remove_none_from_dict.py +11 -0
  26. camb_sdk-1.5.1/camb/core/request_options.py +35 -0
  27. camb_sdk-1.5.1/camb/core/serialization.py +276 -0
  28. camb_sdk-1.5.1/camb/deprecated_streaming/__init__.py +4 -0
  29. camb_sdk-1.5.1/camb/deprecated_streaming/client.py +532 -0
  30. camb_sdk-1.5.1/camb/deprecated_streaming/raw_client.py +639 -0
  31. camb_sdk-1.5.1/camb/dictionaries/__init__.py +4 -0
  32. camb_sdk-1.5.1/camb/dictionaries/client.py +785 -0
  33. camb_sdk-1.5.1/camb/dictionaries/raw_client.py +1048 -0
  34. camb_sdk-1.5.1/camb/dub/__init__.py +49 -0
  35. camb_sdk-1.5.1/camb/dub/client.py +846 -0
  36. camb_sdk-1.5.1/camb/dub/raw_client.py +1194 -0
  37. camb_sdk-1.5.1/camb/dub/types/__init__.py +53 -0
  38. camb_sdk-1.5.1/camb/dub/types/dubbed_output_in_alt_format_request_payload_output_format.py +8 -0
  39. camb_sdk-1.5.1/camb/dub/types/get_dubbed_output_in_alt_format_dub_alt_format_run_id_language_post_response.py +9 -0
  40. camb_sdk-1.5.1/camb/dub/types/get_dubbed_run_info_dub_result_run_id_get_response.py +7 -0
  41. camb_sdk-1.5.1/camb/dub/types/get_dubbing_runs_results_dubbing_results_post_response_value.py +7 -0
  42. camb_sdk-1.5.1/camb/environment.py +8 -0
  43. camb_sdk-1.5.1/camb/errors/__init__.py +34 -0
  44. camb_sdk-1.5.1/camb/errors/unprocessable_entity_error.py +11 -0
  45. camb_sdk-1.5.1/camb/folders/__init__.py +4 -0
  46. camb_sdk-1.5.1/camb/folders/client.py +213 -0
  47. camb_sdk-1.5.1/camb/folders/raw_client.py +278 -0
  48. camb_sdk-1.5.1/camb/languages/__init__.py +4 -0
  49. camb_sdk-1.5.1/camb/languages/client.py +168 -0
  50. camb_sdk-1.5.1/camb/languages/raw_client.py +223 -0
  51. camb_sdk-1.5.1/camb/listen/__init__.py +3 -0
  52. camb_sdk-1.5.1/camb/listen/client.py +24 -0
  53. camb_sdk-1.5.1/camb/listen/v1/__init__.py +5 -0
  54. camb_sdk-1.5.1/camb/listen/v1/client.py +95 -0
  55. camb_sdk-1.5.1/camb/listen/v1/connection.py +224 -0
  56. camb_sdk-1.5.1/camb/listen/v1/events.py +7 -0
  57. camb_sdk-1.5.1/camb/project_setup/__init__.py +4 -0
  58. camb_sdk-1.5.1/camb/project_setup/client.py +537 -0
  59. camb_sdk-1.5.1/camb/project_setup/raw_client.py +655 -0
  60. camb_sdk-1.5.1/camb/py.typed +0 -0
  61. camb_sdk-1.5.1/camb/raw_client.py +236 -0
  62. camb_sdk-1.5.1/camb/story/__init__.py +37 -0
  63. camb_sdk-1.5.1/camb/story/client.py +579 -0
  64. camb_sdk-1.5.1/camb/story/raw_client.py +743 -0
  65. camb_sdk-1.5.1/camb/story/types/__init__.py +38 -0
  66. camb_sdk-1.5.1/camb/story/types/create_story_story_post_response.py +8 -0
  67. camb_sdk-1.5.1/camb/story/types/setup_story_story_setup_post_response.py +8 -0
  68. camb_sdk-1.5.1/camb/streaming/__init__.py +4 -0
  69. camb_sdk-1.5.1/camb/streaming/client.py +645 -0
  70. camb_sdk-1.5.1/camb/streaming/raw_client.py +796 -0
  71. camb_sdk-1.5.1/camb/text_to_audio/__init__.py +4 -0
  72. camb_sdk-1.5.1/camb/text_to_audio/client.py +469 -0
  73. camb_sdk-1.5.1/camb/text_to_audio/raw_client.py +610 -0
  74. camb_sdk-1.5.1/camb/text_to_speech/__init__.py +49 -0
  75. camb_sdk-1.5.1/camb/text_to_speech/client.py +742 -0
  76. camb_sdk-1.5.1/camb/text_to_speech/raw_client.py +948 -0
  77. camb_sdk-1.5.1/camb/text_to_speech/types/__init__.py +47 -0
  78. camb_sdk-1.5.1/camb/text_to_speech/types/create_stream_tts_request_payload_language.py +71 -0
  79. camb_sdk-1.5.1/camb/text_to_speech/types/create_stream_tts_request_payload_speech_model.py +7 -0
  80. camb_sdk-1.5.1/camb/text_to_speech/types/get_tts_results_tts_results_post_response_value.py +7 -0
  81. camb_sdk-1.5.1/camb/text_to_speech/types/get_tts_run_info_tts_result_run_id_get_response.py +7 -0
  82. camb_sdk-1.5.1/camb/text_to_voice/__init__.py +4 -0
  83. camb_sdk-1.5.1/camb/text_to_voice/client.py +329 -0
  84. camb_sdk-1.5.1/camb/text_to_voice/raw_client.py +405 -0
  85. camb_sdk-1.5.1/camb/transcription/__init__.py +4 -0
  86. camb_sdk-1.5.1/camb/transcription/client.py +465 -0
  87. camb_sdk-1.5.1/camb/transcription/raw_client.py +587 -0
  88. camb_sdk-1.5.1/camb/translated_story/__init__.py +4 -0
  89. camb_sdk-1.5.1/camb/translated_story/client.py +309 -0
  90. camb_sdk-1.5.1/camb/translated_story/raw_client.py +381 -0
  91. camb_sdk-1.5.1/camb/translated_tts/__init__.py +4 -0
  92. camb_sdk-1.5.1/camb/translated_tts/client.py +313 -0
  93. camb_sdk-1.5.1/camb/translated_tts/raw_client.py +357 -0
  94. camb_sdk-1.5.1/camb/translation/__init__.py +4 -0
  95. camb_sdk-1.5.1/camb/translation/client.py +631 -0
  96. camb_sdk-1.5.1/camb/translation/raw_client.py +787 -0
  97. camb_sdk-1.5.1/camb/types/__init__.py +233 -0
  98. camb_sdk-1.5.1/camb/types/add_target_language_out.py +20 -0
  99. camb_sdk-1.5.1/camb/types/audio_output_type.py +5 -0
  100. camb_sdk-1.5.1/camb/types/audio_stream.py +31 -0
  101. camb_sdk-1.5.1/camb/types/config_stream.py +22 -0
  102. camb_sdk-1.5.1/camb/types/config_stream_pipeline.py +28 -0
  103. camb_sdk-1.5.1/camb/types/create_custom_voice_out.py +19 -0
  104. camb_sdk-1.5.1/camb/types/create_project_setup_out.py +19 -0
  105. camb_sdk-1.5.1/camb/types/create_stream_out.py +22 -0
  106. camb_sdk-1.5.1/camb/types/create_stream_request_payload.py +70 -0
  107. camb_sdk-1.5.1/camb/types/create_translated_tts_out.py +19 -0
  108. camb_sdk-1.5.1/camb/types/create_tts_out.py +19 -0
  109. camb_sdk-1.5.1/camb/types/data_stream.py +24 -0
  110. camb_sdk-1.5.1/camb/types/demixing_option.py +10 -0
  111. camb_sdk-1.5.1/camb/types/dictionary_term.py +21 -0
  112. camb_sdk-1.5.1/camb/types/dictionary_with_terms.py +28 -0
  113. camb_sdk-1.5.1/camb/types/dubbing_result.py +22 -0
  114. camb_sdk-1.5.1/camb/types/exception_reasons.py +30 -0
  115. camb_sdk-1.5.1/camb/types/folder.py +20 -0
  116. camb_sdk-1.5.1/camb/types/formalities.py +3 -0
  117. camb_sdk-1.5.1/camb/types/gender.py +3 -0
  118. camb_sdk-1.5.1/camb/types/get_audio_separation_result_out.py +20 -0
  119. camb_sdk-1.5.1/camb/types/get_create_project_setup_response.py +21 -0
  120. camb_sdk-1.5.1/camb/types/get_probe_stream_in.py +21 -0
  121. camb_sdk-1.5.1/camb/types/get_probe_stream_out.py +24 -0
  122. camb_sdk-1.5.1/camb/types/get_setup_story_result_response.py +21 -0
  123. camb_sdk-1.5.1/camb/types/get_text_to_voice_result_out.py +19 -0
  124. camb_sdk-1.5.1/camb/types/get_tts_result_out_file_url.py +19 -0
  125. camb_sdk-1.5.1/camb/types/http_validation_error.py +20 -0
  126. camb_sdk-1.5.1/camb/types/language_enums.py +154 -0
  127. camb_sdk-1.5.1/camb/types/language_pydantic_model.py +21 -0
  128. camb_sdk-1.5.1/camb/types/languages.py +3 -0
  129. camb_sdk-1.5.1/camb/types/orchestrator_pipeline_call_result.py +19 -0
  130. camb_sdk-1.5.1/camb/types/orchestrator_pipeline_result.py +25 -0
  131. camb_sdk-1.5.1/camb/types/orchestrator_pipeline_result_exception_reason.py +7 -0
  132. camb_sdk-1.5.1/camb/types/orchestrator_pipeline_result_message.py +5 -0
  133. camb_sdk-1.5.1/camb/types/output_format.py +10 -0
  134. camb_sdk-1.5.1/camb/types/overdub_config.py +37 -0
  135. camb_sdk-1.5.1/camb/types/project_details.py +28 -0
  136. camb_sdk-1.5.1/camb/types/revoicing_option.py +5 -0
  137. camb_sdk-1.5.1/camb/types/run_i_ds_request_payload.py +19 -0
  138. camb_sdk-1.5.1/camb/types/segmenting_option.py +5 -0
  139. camb_sdk-1.5.1/camb/types/source_stream.py +30 -0
  140. camb_sdk-1.5.1/camb/types/story_details.py +27 -0
  141. camb_sdk-1.5.1/camb/types/stream_category.py +3 -0
  142. camb_sdk-1.5.1/camb/types/stream_tts_inference_options.py +38 -0
  143. camb_sdk-1.5.1/camb/types/stream_tts_output_configuration.py +33 -0
  144. camb_sdk-1.5.1/camb/types/stream_tts_voice_settings.py +28 -0
  145. camb_sdk-1.5.1/camb/types/stream_type.py +3 -0
  146. camb_sdk-1.5.1/camb/types/stream_url_for_languages.py +21 -0
  147. camb_sdk-1.5.1/camb/types/target_stream.py +34 -0
  148. camb_sdk-1.5.1/camb/types/task_status.py +5 -0
  149. camb_sdk-1.5.1/camb/types/term_translation_input.py +21 -0
  150. camb_sdk-1.5.1/camb/types/term_translation_output.py +20 -0
  151. camb_sdk-1.5.1/camb/types/text_to_audio_result.py +19 -0
  152. camb_sdk-1.5.1/camb/types/text_to_audio_type.py +5 -0
  153. camb_sdk-1.5.1/camb/types/transcribing_option.py +5 -0
  154. camb_sdk-1.5.1/camb/types/transcript.py +22 -0
  155. camb_sdk-1.5.1/camb/types/transcript_data_type.py +5 -0
  156. camb_sdk-1.5.1/camb/types/transcript_file_format.py +5 -0
  157. camb_sdk-1.5.1/camb/types/transcription_result.py +20 -0
  158. camb_sdk-1.5.1/camb/types/translating_option.py +5 -0
  159. camb_sdk-1.5.1/camb/types/translation_result.py +19 -0
  160. camb_sdk-1.5.1/camb/types/validation_error.py +22 -0
  161. camb_sdk-1.5.1/camb/types/validation_error_loc_item.py +5 -0
  162. camb_sdk-1.5.1/camb/types/video_output_type_without_avi.py +5 -0
  163. camb_sdk-1.5.1/camb/types/video_stream.py +28 -0
  164. camb_sdk-1.5.1/camb/types/voice.py +28 -0
  165. camb_sdk-1.5.1/camb/voice_cloning/__init__.py +34 -0
  166. camb_sdk-1.5.1/camb/voice_cloning/client.py +265 -0
  167. camb_sdk-1.5.1/camb/voice_cloning/raw_client.py +320 -0
  168. camb_sdk-1.5.1/camb/voice_cloning/types/__init__.py +36 -0
  169. camb_sdk-1.5.1/camb/voice_cloning/types/list_voices_list_voices_get_response_item.py +7 -0
  170. camb_sdk-1.5.1/camb_sdk.egg-info/PKG-INFO +220 -0
  171. camb_sdk-1.5.1/camb_sdk.egg-info/SOURCES.txt +341 -0
  172. camb_sdk-1.5.1/camb_sdk.egg-info/dependency_links.txt +1 -0
  173. camb_sdk-1.5.1/camb_sdk.egg-info/requires.txt +5 -0
  174. camb_sdk-1.5.1/camb_sdk.egg-info/top_level.txt +1 -0
  175. camb_sdk-1.5.1/pyproject.toml +27 -0
  176. camb_sdk-1.5.1/setup.cfg +4 -0
  177. camb_sdk-1.5.1/setup.py +24 -0
camb_sdk-1.5.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Camb AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.4
2
+ Name: camb-sdk
3
+ Version: 1.5.1
4
+ Summary: The official Python SDK for the Camb.ai API
5
+ Author-email: "Camb.ai" <support@camb.ai>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: httpx>=0.21.2
13
+ Requires-Dist: pydantic>=1.10.0
14
+ Requires-Dist: typing_extensions>=4.0.0
15
+ Requires-Dist: websockets>=11.0.3
16
+ Requires-Dist: websocket-client>=1.6.0
17
+ Dynamic: license-file
18
+ Dynamic: requires-python
19
+
20
+ # Camb.ai Python SDK
21
+
22
+ [![PyPI version](https://img.shields.io/pypi/v/camb-sdk.svg?style=flat-square)](https://pypi.org/project/camb-sdk/)
23
+ [![License](https://img.shields.io/pypi/l/camb-sdk.svg?style=flat-square)](https://github.com/Camb-ai/cambai-python-sdk/blob/main/LICENSE)
24
+ [![Build status](https://github.com/Camb-ai/cambai-python-sdk/actions/workflows/python.yml/badge.svg)](https://github.com/Camb-ai/cambai-python-sdk/actions/workflows/python.yml)
25
+
26
+
27
+ The official Python SDK for interacting with Camb AI's powerful voice and audio generation APIs. Create expressive speech, unique voices, and rich soundscapes with just a few lines of Python.
28
+
29
+ ## ✨ Features
30
+
31
+ - **Dubbing**: Dub your videos into multiple languages with voice cloning!
32
+ - **Expressive Text-to-Speech**: Convert text into natural-sounding speech using a wide range of pre-existing voices.
33
+ - **Generative Voices**: Create entirely new, unique voices from text prompts and descriptions.
34
+ - **Soundscapes from Text**: Generate ambient audio and sound effects from textual descriptions.
35
+ - Access to voice cloning, translation, and more (refer to full API documentation).
36
+
37
+ ## 📦 Installation
38
+
39
+ Install the SDK using pip, ensure Python 3.9+:
40
+
41
+ ```bash
42
+ pip install camb-sdk
43
+ ```
44
+
45
+ Or through
46
+
47
+ ```bash
48
+ pip install git+https://github.com/Camb-ai/cambai-python-sdk
49
+ ```
50
+
51
+ ## 🔑 Authentication & Accessing Clients
52
+
53
+ To use the Camb AI SDK, you'll need an API key. You can authenticate it by:
54
+
55
+ ```python
56
+ from camb.client import CambAI, AsyncCambAI
57
+
58
+ # Synchronous Client
59
+ client = CambAI(api_key="YOUR_CAMB_API_KEY")
60
+
61
+ # Asynchronous Client
62
+ async_client = AsyncCambAI(api_key="YOUR_CAMB_API_KEY")
63
+ ```
64
+
65
+ ## 🚀 Getting Started: Examples
66
+
67
+ ### 1. Text-to-Speech (TTS)
68
+
69
+ Convert text into spoken audio using one of Camb AI's high-quality voices.
70
+
71
+ #### a) Get an Audio URL or Save to File
72
+
73
+ ```python
74
+ from camb.client import CambAI, save_stream_to_file
75
+ from camb.types.stream_tts_output_configuration import StreamTtsOutputConfiguration
76
+
77
+ # Initialize client (ensure API key is set)
78
+ client = CambAI(api_key="YOUR_CAMB_API_KEY")
79
+
80
+ response = client.text_to_speech.tts(
81
+ text="Hello from Camb AI! This is a test of our Text-to-Speech API.",
82
+ voice_id=20303, # Example voice ID, get from client.voice_cloning.list_voices()
83
+ language="en-us",
84
+ speech_model="mars-8", # options: mars-8, mars-8-flash, mars-8-instruct, auto
85
+ output_configuration=StreamTtsOutputConfiguration(
86
+ format="mp3"
87
+ )
88
+ )
89
+
90
+ save_stream_to_file(response, "tts_output.mp3")
91
+ print("Success! Audio saved to tts_output.mp3")
92
+ ```
93
+
94
+ #### b) Async Text-to-Speech
95
+
96
+ You can also stream audio asynchronously using `AsyncCambAI`.
97
+
98
+ ```python
99
+ import asyncio
100
+ from camb.client import AsyncCambAI, save_async_stream_to_file
101
+ from camb.types.stream_tts_output_configuration import StreamTtsOutputConfiguration
102
+
103
+ async_client = AsyncCambAI(api_key="YOUR_CAMB_API_KEY")
104
+
105
+ async def main():
106
+ response = async_client.text_to_speech.tts(
107
+ text="Hello, this is a test of the text to audio streaming capabilities.",
108
+ language="en-us",
109
+ speech_model="mars-8", # options: mars-8, mars-8-flash, mars-8-instruct, auto
110
+ voice_id=147319,
111
+ output_configuration=StreamTtsOutputConfiguration(
112
+ format="mp3"
113
+ )
114
+ )
115
+ await save_async_stream_to_file(response, "text_to_audio_output.mp3")
116
+ print("Success! Audio saved to text_to_audio_output.mp3")
117
+
118
+ asyncio.run(main())
119
+ ```
120
+
121
+ #### c) List Available Voices
122
+
123
+ You can list available voices to find a voice_id that suits your needs:
124
+
125
+ ```python
126
+ voices = client.voice_cloning.list_voices()
127
+ print(f"Found {len(voices)} voices:")
128
+ for voice in voices[:5]: # Print first 5 as an example
129
+ print(f" - ID: {voice.id}, Name: {voice.voice_name}, Gender: {voice.gender}, Language: {voice.language}")
130
+ ```
131
+
132
+ ### 2. Text-to-Voice (Generative Voice)
133
+
134
+ Create completely new and unique voices from a textual description of the desired voice characteristics.
135
+
136
+ ```python
137
+ from camb.client import CambAI
138
+
139
+ # Initialize client
140
+ client = CambAI(api_key="YOUR_CAMB_API_KEY")
141
+
142
+ try:
143
+ print("Generating a new voice and speech...")
144
+ # Returns 3 sample URLs
145
+ result = client.text_to_voice.create_text_to_voice(
146
+ text="Crafting a truly unique and captivating voice that carries a subtle air of mystery, depth, and gentle warmth.",
147
+ voice_description="A smooth, rich baritone voice layered with a soft echo, ideal for immersive storytelling and emotional depth.",
148
+ )
149
+ print(result)
150
+
151
+ except Exception as e:
152
+ print(f"Exception when calling text_to_voice: {e}\n")
153
+ ```
154
+
155
+ ### 3. Text-to-Audio (Sound Generation)
156
+
157
+ Generate sound effects or ambient audio from a descriptive prompt.
158
+
159
+ ```python
160
+ from camb.client save_stream_to_file
161
+ import time
162
+
163
+ response = client.text_to_audio.create_text_to_audio(
164
+ prompt="A gentle breeze rustling through autumn leaves in a quiet forest.",
165
+ duration=10,
166
+ audio_type="sound"
167
+ )
168
+ task_id = response.task_id
169
+ if task_id:
170
+ while True:
171
+ status = client.text_to_audio.get_text_to_audio_status(task_id=task_id)
172
+ if status.status == "SUCCESS":
173
+ result = client.text_to_audio.get_text_to_audio_result(status.run_id)
174
+ save_stream_to_file(result, "sound_effect.mp3")
175
+ print("Success! Sound effect saved to sound_effect.mp3")
176
+ break
177
+ time.sleep(2)
178
+ ```
179
+
180
+ ### 4. End-to-End Dubbing
181
+
182
+ Dub videos into different languages with voice cloning and translation capabilities.
183
+
184
+ ```python
185
+ from camb.types.language_enums import Languages
186
+
187
+ result = client.dub.create_dub(
188
+ video_url="your_accessible_video_url",
189
+ source_language=Languages.EN_US, # English (Or Check client.languages.get_source_languages())
190
+ target_languages=Languages.HI_IN, # Example target language
191
+ )
192
+ task_id = response.task_id
193
+ print(f"Dub Task created with ID: {task_id}")
194
+ while True:
195
+ status_response = client.dub.get_dubbing_status(task_id=task_id)
196
+ print(f"Current Status: {status_response.status}")
197
+ if status_response.status == "SUCCESS":
198
+ dubbed_run_info = client.dub.get_dubbed_run_info(status_response.run_id)
199
+ print(f"Dubbed Video URL: {dubbed_run_info.audio_url}")
200
+ print(f"Dubbed Video URL: {dubbed_run_info.transcript}")
201
+ print(f"Dubbed Video URL: {dubbed_run_info.video_url}")
202
+ break
203
+ time.sleep(5)
204
+ ```
205
+
206
+ ## ⚙️ Advanced Usage & Other Features
207
+
208
+ The Camb AI SDK offers a wide range of capabilities beyond these examples, including:
209
+
210
+ - Voice Cloning
211
+ - Translated TTS
212
+ - Audio Dubbing
213
+ - Transcription
214
+ - And more!
215
+
216
+ Please refer to the Official Camb AI API Documentation for a comprehensive list of features and advanced usage patterns.
217
+
218
+ ## License
219
+
220
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -0,0 +1,201 @@
1
+ # Camb.ai Python SDK
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/camb-sdk.svg?style=flat-square)](https://pypi.org/project/camb-sdk/)
4
+ [![License](https://img.shields.io/pypi/l/camb-sdk.svg?style=flat-square)](https://github.com/Camb-ai/cambai-python-sdk/blob/main/LICENSE)
5
+ [![Build status](https://github.com/Camb-ai/cambai-python-sdk/actions/workflows/python.yml/badge.svg)](https://github.com/Camb-ai/cambai-python-sdk/actions/workflows/python.yml)
6
+
7
+
8
+ The official Python SDK for interacting with Camb AI's powerful voice and audio generation APIs. Create expressive speech, unique voices, and rich soundscapes with just a few lines of Python.
9
+
10
+ ## ✨ Features
11
+
12
+ - **Dubbing**: Dub your videos into multiple languages with voice cloning!
13
+ - **Expressive Text-to-Speech**: Convert text into natural-sounding speech using a wide range of pre-existing voices.
14
+ - **Generative Voices**: Create entirely new, unique voices from text prompts and descriptions.
15
+ - **Soundscapes from Text**: Generate ambient audio and sound effects from textual descriptions.
16
+ - Access to voice cloning, translation, and more (refer to full API documentation).
17
+
18
+ ## 📦 Installation
19
+
20
+ Install the SDK using pip, ensure Python 3.9+:
21
+
22
+ ```bash
23
+ pip install camb-sdk
24
+ ```
25
+
26
+ Or through
27
+
28
+ ```bash
29
+ pip install git+https://github.com/Camb-ai/cambai-python-sdk
30
+ ```
31
+
32
+ ## 🔑 Authentication & Accessing Clients
33
+
34
+ To use the Camb AI SDK, you'll need an API key. You can authenticate it by:
35
+
36
+ ```python
37
+ from camb.client import CambAI, AsyncCambAI
38
+
39
+ # Synchronous Client
40
+ client = CambAI(api_key="YOUR_CAMB_API_KEY")
41
+
42
+ # Asynchronous Client
43
+ async_client = AsyncCambAI(api_key="YOUR_CAMB_API_KEY")
44
+ ```
45
+
46
+ ## 🚀 Getting Started: Examples
47
+
48
+ ### 1. Text-to-Speech (TTS)
49
+
50
+ Convert text into spoken audio using one of Camb AI's high-quality voices.
51
+
52
+ #### a) Get an Audio URL or Save to File
53
+
54
+ ```python
55
+ from camb.client import CambAI, save_stream_to_file
56
+ from camb.types.stream_tts_output_configuration import StreamTtsOutputConfiguration
57
+
58
+ # Initialize client (ensure API key is set)
59
+ client = CambAI(api_key="YOUR_CAMB_API_KEY")
60
+
61
+ response = client.text_to_speech.tts(
62
+ text="Hello from Camb AI! This is a test of our Text-to-Speech API.",
63
+ voice_id=20303, # Example voice ID, get from client.voice_cloning.list_voices()
64
+ language="en-us",
65
+ speech_model="mars-8", # options: mars-8, mars-8-flash, mars-8-instruct, auto
66
+ output_configuration=StreamTtsOutputConfiguration(
67
+ format="mp3"
68
+ )
69
+ )
70
+
71
+ save_stream_to_file(response, "tts_output.mp3")
72
+ print("Success! Audio saved to tts_output.mp3")
73
+ ```
74
+
75
+ #### b) Async Text-to-Speech
76
+
77
+ You can also stream audio asynchronously using `AsyncCambAI`.
78
+
79
+ ```python
80
+ import asyncio
81
+ from camb.client import AsyncCambAI, save_async_stream_to_file
82
+ from camb.types.stream_tts_output_configuration import StreamTtsOutputConfiguration
83
+
84
+ async_client = AsyncCambAI(api_key="YOUR_CAMB_API_KEY")
85
+
86
+ async def main():
87
+ response = async_client.text_to_speech.tts(
88
+ text="Hello, this is a test of the text to audio streaming capabilities.",
89
+ language="en-us",
90
+ speech_model="mars-8", # options: mars-8, mars-8-flash, mars-8-instruct, auto
91
+ voice_id=147319,
92
+ output_configuration=StreamTtsOutputConfiguration(
93
+ format="mp3"
94
+ )
95
+ )
96
+ await save_async_stream_to_file(response, "text_to_audio_output.mp3")
97
+ print("Success! Audio saved to text_to_audio_output.mp3")
98
+
99
+ asyncio.run(main())
100
+ ```
101
+
102
+ #### c) List Available Voices
103
+
104
+ You can list available voices to find a voice_id that suits your needs:
105
+
106
+ ```python
107
+ voices = client.voice_cloning.list_voices()
108
+ print(f"Found {len(voices)} voices:")
109
+ for voice in voices[:5]: # Print first 5 as an example
110
+ print(f" - ID: {voice.id}, Name: {voice.voice_name}, Gender: {voice.gender}, Language: {voice.language}")
111
+ ```
112
+
113
+ ### 2. Text-to-Voice (Generative Voice)
114
+
115
+ Create completely new and unique voices from a textual description of the desired voice characteristics.
116
+
117
+ ```python
118
+ from camb.client import CambAI
119
+
120
+ # Initialize client
121
+ client = CambAI(api_key="YOUR_CAMB_API_KEY")
122
+
123
+ try:
124
+ print("Generating a new voice and speech...")
125
+ # Returns 3 sample URLs
126
+ result = client.text_to_voice.create_text_to_voice(
127
+ text="Crafting a truly unique and captivating voice that carries a subtle air of mystery, depth, and gentle warmth.",
128
+ voice_description="A smooth, rich baritone voice layered with a soft echo, ideal for immersive storytelling and emotional depth.",
129
+ )
130
+ print(result)
131
+
132
+ except Exception as e:
133
+ print(f"Exception when calling text_to_voice: {e}\n")
134
+ ```
135
+
136
+ ### 3. Text-to-Audio (Sound Generation)
137
+
138
+ Generate sound effects or ambient audio from a descriptive prompt.
139
+
140
+ ```python
141
+ from camb.client save_stream_to_file
142
+ import time
143
+
144
+ response = client.text_to_audio.create_text_to_audio(
145
+ prompt="A gentle breeze rustling through autumn leaves in a quiet forest.",
146
+ duration=10,
147
+ audio_type="sound"
148
+ )
149
+ task_id = response.task_id
150
+ if task_id:
151
+ while True:
152
+ status = client.text_to_audio.get_text_to_audio_status(task_id=task_id)
153
+ if status.status == "SUCCESS":
154
+ result = client.text_to_audio.get_text_to_audio_result(status.run_id)
155
+ save_stream_to_file(result, "sound_effect.mp3")
156
+ print("Success! Sound effect saved to sound_effect.mp3")
157
+ break
158
+ time.sleep(2)
159
+ ```
160
+
161
+ ### 4. End-to-End Dubbing
162
+
163
+ Dub videos into different languages with voice cloning and translation capabilities.
164
+
165
+ ```python
166
+ from camb.types.language_enums import Languages
167
+
168
+ result = client.dub.create_dub(
169
+ video_url="your_accessible_video_url",
170
+ source_language=Languages.EN_US, # English (Or Check client.languages.get_source_languages())
171
+ target_languages=Languages.HI_IN, # Example target language
172
+ )
173
+ task_id = response.task_id
174
+ print(f"Dub Task created with ID: {task_id}")
175
+ while True:
176
+ status_response = client.dub.get_dubbing_status(task_id=task_id)
177
+ print(f"Current Status: {status_response.status}")
178
+ if status_response.status == "SUCCESS":
179
+ dubbed_run_info = client.dub.get_dubbed_run_info(status_response.run_id)
180
+ print(f"Dubbed Video URL: {dubbed_run_info.audio_url}")
181
+ print(f"Dubbed Video URL: {dubbed_run_info.transcript}")
182
+ print(f"Dubbed Video URL: {dubbed_run_info.video_url}")
183
+ break
184
+ time.sleep(5)
185
+ ```
186
+
187
+ ## ⚙️ Advanced Usage & Other Features
188
+
189
+ The Camb AI SDK offers a wide range of capabilities beyond these examples, including:
190
+
191
+ - Voice Cloning
192
+ - Translated TTS
193
+ - Audio Dubbing
194
+ - Transcription
195
+ - And more!
196
+
197
+ Please refer to the Official Camb AI API Documentation for a comprehensive list of features and advanced usage patterns.
198
+
199
+ ## License
200
+
201
+ This project is licensed under the MIT License - see the LICENSE file for details.