Skip to main content

A Text-to-Speech and Podcast generation library using Chatterbox Turbo TTS

Project description

OneLab TTS Library

OneLab is a powerful Python library for Text-to-Speech (TTS) and Podcast generation, built on top of ChatterboxTurboTTS. It allows you to easily convert text to speech using various voices and create multi-speaker podcasts with custom logging and progress tracking.

Features

  • Text-to-Speech Conversion: Convert individual text segments to audio using specific voices.
  • Podcast Generation: Create full conversations with multiple speakers.
  • Dynamic Voice Loading: Automatically detects available voices from the package's sample directory.
  • Custom Logging: Detailed logging and progress tracking during generation.
  • Modular Design: Clean and extensible architecture.

Installation

You can install the package using pip:

pip install onelab

Or install directly from the source:

git clone https://github.com/satadeep3927/onelab.git
cd onelab
pip install .

Usage

Initialization

To use the library, simply initialize the OneLab class. The library automatically locates the bundled voice samples.

from onelab import OneLab

# Initialize OneLab
onelab = OneLab(device="cpu") 

Listing Available Voices

You can list all voices detected in the sample directory:

voices = onelab.tts.list_voices()
print("Available voices:", voices)

Converting Text to Speech

To convert a single line of text:

wav = onelab.tts.convert("Hello, world!", voice="charlie")
# Save the output
import torchaudio
torchaudio.save("output.wav", wav, onelab.tts.model.sr)

Creating a Podcast

To create a multi-speaker podcast, define your conversation segments and use the podcast.create method:

from onelab import ConversationInput

data: ConversationInput = {
    "segments": [
        {"voice": "charlie", "text": "Hello Emilia!"},
        {"voice": "emilia", "text": "Hi Charlie! How are you?"},
    ]
}

# Generate the podcast
podcast_wav = onelab.tts.podcast.create(data)

# Save the podcast
torchaudio.save("podcast.wav", podcast_wav, onelab.tts.model.sr)

API Reference

OneLab

The main entry point for the library.

  • __init__(device: str = "cpu"): Initializes the library.

TextToSpeech (accessed via onelab.tts)

Handles TTS operations.

  • list_voices() -> List[str]: Returns a list of available voice names.
  • convert(text: str, voice: str) -> torch.Tensor: Generates audio for the given text and voice.

Podcast (accessed via onelab.tts.podcast)

Handles podcast generation.

  • create(args: ConversationInput) -> torch.Tensor: Generates a concatenated audio waveform for the entire conversation.

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

onelab_tts-0.4.0.tar.gz (32.2 MB view details)

Uploaded Source

Built Distribution

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

onelab_tts-0.4.0-py3-none-any.whl (32.2 MB view details)

Uploaded Python 3

File details

Details for the file onelab_tts-0.4.0.tar.gz.

File metadata

  • Download URL: onelab_tts-0.4.0.tar.gz
  • Upload date:
  • Size: 32.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for onelab_tts-0.4.0.tar.gz
Algorithm Hash digest
SHA256 6c30ce378be1f48eed80f55f383e8ae2d8c513a28e1af367459d3c9112e50dc9
MD5 e3e31a62feb5bea7c1ab4bfa5b02612f
BLAKE2b-256 0a14cf340429dad61b6668f3c7f64e96f4e282fbd19be49f0c81f889b04a6388

See more details on using hashes here.

File details

Details for the file onelab_tts-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: onelab_tts-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 32.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for onelab_tts-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 43e2c7b15aa715927445e6eafa37016b17fa3709efdb8166a9d262591b90d17b
MD5 9cdd4755ec9675c9f7726c1cdf225a81
BLAKE2b-256 7fc8a140eb83566ac907fbdc722eb97bfa7ea660e5a11943b0102bd7bb403738

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