Skip to main content

Aiola Text-To-Speech Python SDK

Project description

aiOla Text-to-Speech SDK

The aiOla Text-to-Speech SDK provides Python bindings for aiOla's text-to-speech services, enabling high-quality voice synthesis with multiple voice options.

Features

  • Text-to-speech synthesis
  • Multiple voice options
  • Streaming support
  • Customizable audio formats
  • Error handling and logging

Installation

pip install aiola-tts

Usage

Basic Usage

from aiola_tts import AiolaTtsClient, AudioFormat

# Initialize client
client = AiolaTtsClient(
    base_url="your-base-url",  # i.e https://api.aiola.ai
    bearer_token="your-bearer-token",
    audio_format=AudioFormat.LINEAR16  # or AudioFormat.PCM
)

# Synthesize text to speech
audio_data = client.synthesize(
    text="Hello, world!",
    voice="af_bella"  # Optional, defaults to "af_bella"
)

# Save the audio data to a file
with open("output.wav", "wb") as f:
    f.write(audio_data)

Streaming Support

# Stream text-to-speech audio
streamed_audio = client.synthesize_stream(
    text="Hello, world!",
    voice="af_bella"  # Optional, defaults to "af_bella"
)

# Process the streamed audio data
with open("streamed_output.wav", "wb") as f:
    f.write(streamed_audio)

Available Voices

The SDK supports multiple voice options:

# Female voices
"af_bella"    # Default voice
"af_nicole"
"af_sarah"
"af_sky"

# Male voices
"am_adam"
"am_michael"
"bf_emma"
"bf_isabella"
"bm_george"
"bm_lewis"

Audio Format Configuration

The SDK supports two audio formats:

from aiola_tts import AudioFormat

# LINEAR16 format (default)
client = AiolaTtsClient(
    base_url="your-base-url",
    bearer_token="your-bearer-token",
    audio_format=AudioFormat.LINEAR16
)

# PCM format
client = AiolaTtsClient(
    base_url="your-base-url",
    bearer_token="your-bearer-token",
    audio_format=AudioFormat.PCM
)

Development

To install development dependencies:

pip install -e ".[dev]"

Error Handling

The SDK provides comprehensive error handling:

try:
    audio_data = client.synthesize("Hello, world!")
except requests.exceptions.RequestException as e:
    print(f"Error: {str(e)}")

License

MIT License

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

aiola_tts-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiola_tts-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file aiola_tts-1.0.0.tar.gz.

File metadata

  • Download URL: aiola_tts-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for aiola_tts-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aad2dfd8c8848d02061e9d4284eba61844aa111e7ecd22196d6828900cf2604a
MD5 f7abe554ab71ddb56bb99b10f6930274
BLAKE2b-256 f4c1a146f4b6600f2b0c737f793461db8761041117806685231016512ac1baae

See more details on using hashes here.

File details

Details for the file aiola_tts-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aiola_tts-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for aiola_tts-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42c6a675c658ab3dd8511e6448226abc7f4420c953aa715886c8d79b7785ff43
MD5 fe0eb534abce1b31bfb74f28b1319881
BLAKE2b-256 115056f563bebe8ea8059f1040b9276c70cc98534ac8d0d696d51cacba7b1a22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page