Official 60db SDK for Python
Project description
60db
Official 60db SDK for Python
Installation
pip install 60db
Quick Start
from sixtydb import SixtyDBClient
def fetch_and_display_voices(client: SixtyDBClient) -> str:
"""
Fetch all available voices and print their details.
Returns:
str: Selected voice_id
"""
try:
response = client.get_voices()
except Exception as exc:
print("Error fetching voices:", exc)
raise
if not response.get("success"):
raise Exception(response.get("message"))
voices = response["data"]["built_in_voices"]
if not voices:
raise Exception("No voices available.")
print("\nAvailable Voices:\n" + "-" * 40)
for voice in voices:
print(
f"Name: {voice.get('name')} | "
f"Voice ID: {voice.get('voice_id')} | "
f"Language: {voice.get('language_name')} | "
f"Gender: {voice.get('gender')}"
)
return voices[0]["voice_id"]
def generate_speech(client: SixtyDBClient, voice_id: str) -> None:
"""
Generate speech and save to file.
"""
try:
audio = client.text_to_speech(
text="Hello, world!",
voice_id=voice_id,
speed=1.0
)
with open("output.mp3", "wb") as file:
file.write(audio)
print("\nAudio saved to output.mp3")
except Exception as exc:
print("Error generating speech:", exc)
raise
def main() -> None:
try:
client = SixtyDBClient("your-api-key")
except Exception as exc:
print("Error creating client:", exc)
return
try:
voice_id = fetch_and_display_voices(client)
generate_speech(client, voice_id)
except Exception as exc:
print("Operation failed:", exc)
if __name__ == "__main__":
main()
API Methods
Text-to-Speech
text_to_speech(text, voice_id=None, **params)– Convert text to speech
Speech-to-Text
speech_to_text(audio_file, language=None)– Transcribe audioget_languages()– Get supported languages
Voices
get_voices()– List all voices
Example: Speech to Text
from sixtydb import SixtyDBClient
client = SixtyDBClient("your-api-key")
try:
with open("output.mp3", "rb") as file:
result = client.speech_to_text(file, language="en")
if result.get("success"):
print("Transcription:", result["data"]["text"])
else:
print("STT Error:", result.get("message"))
except Exception as exc:
print("Error during transcription:", exc)
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
60db-1.0.8.tar.gz
(5.0 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
60db-1.0.8-py3-none-any.whl
(5.0 kB
view details)
File details
Details for the file 60db-1.0.8.tar.gz.
File metadata
- Download URL: 60db-1.0.8.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f8ebdcb38d25cb6b9804c1b5c9ab4a038a93462e17b73def9fe0d18decc0830
|
|
| MD5 |
ad1d6659c4f2c14eadc568bc5b230f8d
|
|
| BLAKE2b-256 |
2ac2c06d7713f62a9be517484ee7d804c3bb52279a3a2cf0a27bec0ee10dce9d
|
File details
Details for the file 60db-1.0.8-py3-none-any.whl.
File metadata
- Download URL: 60db-1.0.8-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b36161339f465eef659d130835d230cff495e0062eae19a232bb78ea0cb41c8
|
|
| MD5 |
c63ce2856844cbd6b296319a69e1201a
|
|
| BLAKE2b-256 |
1fb36477dcaa2ee3b0121a9b30fb38cc2a123e281de17a4dade78b69697b5c64
|