Python client for the Sonantic API
Project description
Sonantic Python Library
Interact with the Sonantic API from Python.
Installation
You can install sonantic from PyPI
pip install sonantic
Example
You will need to set your API key which can be found in your Sonantic Dashboard
import sonantic
from sonantic.core import Error
# make sure to set the API key before you call any methods
sonantic.api_key = "live_c..."
# list available voices
voices = sonantic.voices.list()
print("Available voices")
for voice in voices.items:
print(f"\t{voice.name}")
print()
print("Creating speech...")
speech = sonantic.speech.create(
voice="taylor", text="The quick brown fox jumps over the lazy dog."
)
# check the request was successful and handle the error otherwise
if isinstance(speech, Speech):
path = f"./{speech.id}.wav"
print(f"Saving audio to file {path}")
# store generated speech - the audio is decoded by default
with open(path, "bx") as f:
f.write(speech.audio.content)
else:
# handle the error
print(speech.error)
print(speech.message)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sonantic-0.1.0.tar.gz
(6.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sonantic-0.1.0.tar.gz.
File metadata
- Download URL: sonantic-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ace1bc1fa24854369f952f963a967bd153c9b4bfc2383e8788ef28d4a20c9b4c
|
|
| MD5 |
2c653e0ee528e897a80c3c82f0d91882
|
|
| BLAKE2b-256 |
a97a3e3043502ab4118b2029a42978e56f8c2ee90726c06c198756b5363b61f4
|
File details
Details for the file sonantic-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sonantic-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e1fff45a6a16ce724f0af5a5416922c65e35c515b6ff074d1c5634751422279
|
|
| MD5 |
6ebf8d103f7dda1d89f5bc128088f61f
|
|
| BLAKE2b-256 |
309bb9dd34173798a52d870ce492cdd388c2b8719a0edb066e50853040efe9f5
|