60db
توضیحات
Official 60db SDK for Python
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | 60db-1.0.8 |
| نام | 60db |
| نسخه کتابخانه | 1.0.8 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | 60db |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/60db/ |
| مجوز | MIT |
# 60db
Official 60db SDK for Python
## Installation
```bash
pip install 60db
```
## Quick Start
```python
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 audio
- `get_languages()` – Get supported languages
### Voices
- `get_voices()` – List all voices
---
## Example: Speech to Text
```python
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
نیازمندی
| مقدار | نام |
|---|---|
| - | requests>=2.28.0 |
| - | typing-extensions>=4.0.0 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl 60db-1.0.8:
pip install 60db.whl
نصب پکیج tar.gz 60db-1.0.8:
pip install 60db.tar.gz