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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file ttsdg-1.1.3.tar.gz.

File metadata

  • Download URL: ttsdg-1.1.3.tar.gz
  • Upload date:
  • Size: 240.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.11.1 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.7.7

File hashes

Hashes for ttsdg-1.1.3.tar.gz
Algorithm Hash digest
SHA256 b6ccc4fe134ec910befdb1cb4cc3be5848e8ba65327c0c878b8043484b9431f2
MD5 21e7f5c54a2f8e65505f5e55f57acf43
BLAKE2b-256 ac2caa9adba8e5e64bf7d9e84d6ca03ad5c0024bf8d9a1080087460b03074f67

See more details on using hashes here.

File details

Details for the file ttsdg-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: ttsdg-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.11.1 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.7.7

File hashes

Hashes for ttsdg-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dce578d8f029cd8c46da53d969158ff7a817d88d0d1b42dba157320d33e3ea79
MD5 dd085caf8250e1faa62675f09cdc7c56
BLAKE2b-256 6cdb2265891287627f7694397b21d7b4aa9f1bfdd53809562631a2164aaeddbc

See more details on using hashes here.

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