Skip to main content

A package to automate TTS data generation

Project description

TTSDG

TTSDG, or Text-To-Speech Data Generator, automates the simple-but-frustrating task of generating large amounts of TTS data for tasks like machine learning. TTSDG contains an easy-to-use class that can generate text offline, in large batches, and with control over the system voices that you have installed. TTSDG randomizes volume, speed, and voice of each sample, and prevents duplicates from happening.

TTSDG utilizes pyttsx3 and pydub to generate the audio and convert it into multiple formats. All pydub-supported formats are supported in TTSDG, like WAV, MP3, and AIFF.

Installation

TTSDG is available through pip:

python3 -m pip install ttsdg

Usage

from ttsdg import TTSDG

for word in ["Apple", "Orange", "Banana"]:
    print(word)

    gen = TTSDG(verbose=True)
    gen.volume_range = [.5, 1.0]
    gen.wpm_range = [200, 300]

    gen.generate(word, 100, out_format="wav")

    # A bug in pyttsx3 will cause hangs on generation
    # in loops sometimes. del the generator at the end 
    # of the loop to solve this
    del gen

Methods

  • set_volume_range(low, high, one) - Set low or high volume bounds, or set one for a specific value.
  • set_wpm_range(low, high, one) - Set low or high speed bounds (in words per minute), or set one for a specific value.
  • set_voices(voices) - Only mess around with this if you know what you're doing. Sets the list of voices to choose from, relies on what system voices you have installed.
  • set_engine(engine) - Only mess around with this if you know what you're doing. Sets the pyttsx3 Engine object, useful for importing settings if your project already has an engine.
  • get_engine() - Gets the pyttsx3 engine object.
  • generate(text, n, out_format) - Generates n samples of the input text, saves them to ./(text)/(text)_index.(out_format)

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

ttsdg-1.1.3.tar.gz (240.7 kB view hashes)

Uploaded Source

Built Distribution

ttsdg-1.1.3-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

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