Skip to main content

A simple text-to-speech library

Project description

Primitive TTS

Primitive TTS is a text-to-speech (TTS) library intended to have as simple of an implementation as possible. Its creation was brought about by the fact that although numerous other speech synthesis libraries exist, they almost ubiquitously seem to suffer from one of the following issues:

  • Complex or strict dependencies, often failing to install on various *nix distributions
  • Unclear licensing of produced voices
  • Have received low, or no maintenance in several years
  • The available voices don't quite fit what I'm building

In an attempt to remedy this, Primitive TTS achieves is built using:

  • Minimal dependencies - wave audio for example is natively supported in Python
  • Allows commercial use for the generated speech
  • Is designed with simplicity in mind to encourage and allow for low effort of maintainability

The generated speech is far from perfect, is not high quality, and when a simple alternative comes along I'll switch to that.

Anecdotally, there was a period of time from 2000 to 2015 where excessive plastic housings and computer monitored hardware seemed to be rapidly encroaching around the engines and other reparable areas of both pedestrian and industrial vehicles. Not that this is fully a first hand observation, but rather what I observed through lense of my father (who is notably the main influence that led me to pursue technology as a line of work). With over 50 years experience as a mechanic working on countless different machines, he still needed additional specialized tools and training. That's where the inspiration for Primitive TTS comes in. There is a significant learning curve between a standard multimeter, and proprietary diagnostic software - not to mention the factors of price and access. I'm seeing similar themes within the current bloom of artificial intelligence. Various AI models are limited to specific brands of hardware, and have significant resource requirements (memory, GPU, etc.). I know for certain that within a few years these limitations will ebb as the software becomes more distilled and standard catches up with it. But until then I think it might help to have at least some software that can be fixed and edited easily, using standard and widely available tools.

Design

Primitive TTS uses a set of 39 phonemes that are compatible with The CMU Pronouncing Dictionary - phonemes being the distinct units of sound in a given language, and represented herein by the following letter codes:

AA, AE, AH, AO, AW, AY, B, CH, D, DH, EH, ER, EY,
F, G, HH, IH, IY, JH, K, L , M, N, NG, OW, OY, P,
R, S, SH, T, TH, UH, UW, V, W, Y, Z, ZH

To generate speech, text is split into tokens (words) and each word is split into chunks consisting of two letters. For example, the word "system" becomes ["sy", "st", "em"]. Each two-letter chunk is mapped to a set of phonemes, which in this example would be [S, AY], [S, T], [AH, M]. Speech is then produced by stitching together the wav files corresponding to each phoneme.

Odd length words are handled by selecting one letter at random and doubling it. This generally seems ok because there is also logic that removed duplicate consecutive phonemes before generating the combined wave file, this deduplication reduces jitter in the generated speech.

Splitting words two letter chunks results in a relatively small finite set of possible letter combinations for the 26 letters of the english language (26² = 676).

Language Support

Currently only american english is supported, but theoretically support for other languages could be added by adding new phoneme mappings (see the en and en.py set as examples).

Voices

This library is only going to support one "voice", which although not expressly named anywhere within the code, is refereed to as the "Salvius voice". This voice aims to be principally recognizable as the voice of the humanoid robot, Salvius.

Installation

pip install primitive-tts

Usage

from primitive_tts.speech import speak

speak('system online')

Samples

"system online"

Audio sample cannot be rendered.

"lorem ipsum"

Audio sample cannot be rendered.

Attention captain I have finished my analysis

Audio sample cannot be rendered.

The quick brown fox jumps over the lazy dog

Audio sample cannot be rendered.

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

primitive_tts-0.0.1.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

primitive_tts-0.0.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file primitive_tts-0.0.1.tar.gz.

File metadata

  • Download URL: primitive_tts-0.0.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.0

File hashes

Hashes for primitive_tts-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ad0422361d8fd176235e87f46667dd984a85d305e18109590670e6d6dcca0d99
MD5 e8a2ea0f35836d6923ed8bb23a4c7942
BLAKE2b-256 6dbb16fef2994a66a52a4b451cec4188b81059d3b550f31df0b13b493f65095a

See more details on using hashes here.

File details

Details for the file primitive_tts-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for primitive_tts-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c75c3d8152832306bcbbbefb3d7ea0fce406a24c357864375688c021965411f
MD5 dccc15573e280ab2bded40ed9cfc2d39
BLAKE2b-256 94e04250c79af4d15beb5300b56c26476d323c6d890a7da7da319393cff13c5b

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