Skip to main content

TTS extension for multiai using OpenAI, Google GenAI and Azure Speech

Project description

multiai-tts

multiai-tts is an extension library for multiai that provides Text-to-Speech (TTS) capabilities using OpenAI, Google GenAI, and Azure Speech.

Prerequisites

API Key Configuration

This library relies on the configuration provided by multiai. You must set up your API keys (OpenAI API Key, Google API Key, Azure TTS Key and Region) using multiai's configuration files or environment variables before using this library.

For details on how to configure API keys, please refer to the multiai documentation.

System Requirements

  • ffmpeg must be installed if you want to save audio in formats other than WAV (e.g., MP3).
  • pydub is required for audio conversion.

Installation

pip install multiai-tts

Usage

Google GenAI Example

import sys
import multiai_tts

client = multiai_tts.Prompt()
client.set_tts_model('google', 'gemini-2.5-flash-preview-tts')
client.tts_voice_google = 'charon'

# Speak directly
client.speak("Hello, this is a test from Google model.")
if client.error:
    print(client.error_message)
    sys.exit(1)

# Save to file
client.save_tts("Saving this audio to mp3.", "output_google.mp3")
if client.error:
    print(client.error_message)
    sys.exit(1)

OpenAI Example

import sys
import multiai_tts

client = multiai_tts.Prompt()
client.set_tts_model('openai', 'gpt-4o-mini-tts')
client.tts_voice_openai = 'marin'

# Speak directly
client.speak("Hello, this is a test from OpenAI model.")
if client.error:
    print(client.error_message)
    sys.exit(1)

# Save to file
client.save_tts("Saving this audio to mp3.", "output_openai.mp3")
if client.error:
    print(client.error_message)
    sys.exit(1)

Azure TTS Example

import sys
import multiai_tts

client = multiai_tts.Prompt()
client.set_tts_provider('azure')
client.tts_voice_azure = 'en-US-JennyNeural'

# Speak directly
client.speak("Hello, this is a test from Azure TTS.")
if client.error:
    print(client.error_message)
    sys.exit(1)

# Save to file
client.save_tts("Saving this audio to mp3.", "output_azure.mp3")
if client.error:
    print(client.error_message)
    sys.exit(1)

Notes

  • Prompt.get_wav() fetches the raw audio data in memory. Playback is separate from retrieval.
  • Error handling: After speak() or save_tts(), always check client.error and client.error_message.
  • WAV output is default; use pydub/ffmpeg for other formats.

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

multiai_tts-0.2.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

multiai_tts-0.2.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file multiai_tts-0.2.0.tar.gz.

File metadata

  • Download URL: multiai_tts-0.2.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for multiai_tts-0.2.0.tar.gz
Algorithm Hash digest
SHA256 df4499530133fb93dfbafdd074dbae2d43e4025dc4a7de8f27669c0801cff45c
MD5 6935ee0bf8f4bc1af5be13c7b9725002
BLAKE2b-256 e4cf702e736e54728bce372aba50567cdf6f95ad3ab3876b07b1984ef75b2513

See more details on using hashes here.

File details

Details for the file multiai_tts-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: multiai_tts-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for multiai_tts-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43837ed1849861a8a5b618f4e38f4a42c768554f96eff7e7b53f69189d7c6ccd
MD5 5553722a1a8869153e847de8c285266a
BLAKE2b-256 bc0cf2bf5e55a3a18dfa7726e5136b792201adb6d6589fe8bc7960c7fe55c788

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