smallestai 1.1.0__py3-none-any.whl → 1.2.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.

Potentially problematic release.


This version of smallestai might be problematic. Click here for more details.

smallest/tts.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import wave
2
3
  import copy
3
4
  import requests
4
5
  from typing import Optional, Union, List
@@ -128,7 +129,11 @@ class Smallest:
128
129
  with open(save_as, "wb") as wf:
129
130
  wf.write(audio_content)
130
131
  else:
131
- raise TTSError("WAV header is required for saving audio. Set 'add_wav_header=True' to add a WAV header.")
132
+ with wave.open(save_as, "wb") as wf:
133
+ wf.setnchannels(1)
134
+ wf.setsampwidth(2)
135
+ wf.setframerate(self.opts.sample_rate)
136
+ wf.writeframes(audio_content)
132
137
  return None
133
138
 
134
139
  return audio_content
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: smallestai
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Official Python client for the Smallest AI API
5
5
  Author-email: Smallest <info@smallest.ai>
6
6
  License: MIT
@@ -88,9 +88,7 @@ from smallest import Smallest
88
88
 
89
89
  def main():
90
90
  client = Smallest(api_key=os.environ.get("SMALLEST_API_KEY"))
91
- audio_data = client.synthesize("Hello, this is a test for sync synthesis function.")
92
- with open("sync_synthesize.wav", "wb") as f:
93
- f.write(audio_data)
91
+ client.synthesize("Hello, this is a test for sync synthesis function.", save_as="sync_synthesize.wav")
94
92
 
95
93
  if __name__ == "__main__":
96
94
  main()
@@ -107,7 +105,7 @@ if __name__ == "__main__":
107
105
  - `remove_extra_silence`: Remove additional silence (default: True)
108
106
 
109
107
  ### Async
110
- A synchronous text-to-speech synthesis client.
108
+ Asynchronous text-to-speech synthesis client.
111
109
 
112
110
  **Basic Usage:**
113
111
  ```python
@@ -120,9 +118,9 @@ client = AsyncSmallest(api_key=os.environ.get("SMALLEST_API_KEY"))
120
118
 
121
119
  async def main():
122
120
  async with client as tts:
123
- audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
121
+ audio_bytes = await tts.synthesize("Hello, this is a test of the async synthesis function.")
124
122
  async with aiofiles.open("async_synthesize.wav", "wb") as f:
125
- await f.write(audio_bytes)
123
+ await f.write(audio_bytes) # alternatively you can use the `save_as` parameter.
126
124
 
127
125
  if __name__ == "__main__":
128
126
  asyncio.run(main())
@@ -3,10 +3,10 @@ smallest/async_tts.py,sha256=w_SY1Oetn5Zorq-8JXA7lGeRHR3kTtBzqotc_hF0hOQ,6010
3
3
  smallest/exceptions.py,sha256=41GLVvNTfRQMQsPLGk0lHuhK2mak8_dVtiFLEtT23Dc,333
4
4
  smallest/models.py,sha256=R5UZZA9SibrJ2DsWPi_mkKI13WfyC-MLd-7kptfjns4,390
5
5
  smallest/stream_tts.py,sha256=1j4JpAwrAmwprC98mKQwuhXf0HFxFTlMcZ3_JAdcAK0,5416
6
- smallest/tts.py,sha256=Gr13I-O0qH7EclnR_g29qcpiqITWjgfjCFxFwNxyZrA,5410
6
+ smallest/tts.py,sha256=2v6kBPC_hocWdvt2Uua2aQgzg3BKQGIFXpq2DZMz9aA,5540
7
7
  smallest/utils.py,sha256=hAgyEfZEnvayzu8qS4LXhpZR8qK7z4gatLWGVOkS3Yg,2183
8
- smallestai-1.1.0.dist-info/LICENSE,sha256=kK3HNKhN7luQhkjkNWIvy9_gizbEDUM4mSv_HWq9uuM,1068
9
- smallestai-1.1.0.dist-info/METADATA,sha256=e1ivgFjFyvXKPKGXoa8jSH7pqUsmiqoqNk0Q_Mjq3yM,8723
10
- smallestai-1.1.0.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
11
- smallestai-1.1.0.dist-info/top_level.txt,sha256=i5ktbWkG-2aS28vrYTeuhKtA-tY2ZG7SHgLHi87QTLw,9
12
- smallestai-1.1.0.dist-info/RECORD,,
8
+ smallestai-1.2.0.dist-info/LICENSE,sha256=kK3HNKhN7luQhkjkNWIvy9_gizbEDUM4mSv_HWq9uuM,1068
9
+ smallestai-1.2.0.dist-info/METADATA,sha256=qsNxKNN-KNTshjeBBh9AhS_yeYzlHEqPlt_9zuV2fGY,8717
10
+ smallestai-1.2.0.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
11
+ smallestai-1.2.0.dist-info/top_level.txt,sha256=i5ktbWkG-2aS28vrYTeuhKtA-tY2ZG7SHgLHi87QTLw,9
12
+ smallestai-1.2.0.dist-info/RECORD,,