Skip to main content

Python interface for Mary TTS

Project description

A pretty simple HTTP based interface to MaryTTS intended to make using this excellent TTS for waveform and IPA generation as convenient as possible.

Target audience are developers who would like to use MaryTTS as-is for speech synthesis in their Python application on GNU/Linux operating systems.

Constructive comments, patches and pull-requests are very welcome.

Examples

First, imports:

import wave import StringIO from marytts import MaryTTS

english (default) synthesis:

marytts = MaryTTS() wavs = marytts.synth_wav(‘Hello World!’) wav = wave.open(StringIO.StringIO(wavs)) print wav.getnchannels(), wav.getframerate(), wav.getnframes()

result:

1 16000 21520

try a different language:

marytts.locale = ‘de’ marytts.voice = ‘bits3’ wavs = marytts.synth_wav(‘Hallo Welt!’) wav = wave.open(StringIO.StringIO(wavs)) print wav.getnchannels(), wav.getframerate(), wav.getnframes()

result:

1 16000 16760

### List Available Voices

l = marytts.voices

result:

>>> l[0]
['upmc-pierre-hsmm', 'fr', 'male', 'hmm']
>>> l[1]
['dfki-pavoque-neutral-hsmm', 'de', 'male', 'hmm']
>>> l[2]
['cmu-slt-hsmm', 'en_US', 'female', 'hmm']
>>> l[3]
['cmu-rms-hsmm', 'en_US', 'male', 'hmm']
...

### Grapheme to Phoneme (G2P) Conversion

marytts.locale = ‘en_US’ marytts.voice = ‘cmu-rms-hsmm’ cs = marytts.g2p (‘Hello World!’)

result:

>>> cs
"h @ - ' l @U ' w r= l d"

### Synthesize Phonemes

wavs = marytts.synth_wav(“h @ - ‘ l @U ‘ w r= l d”, fmt=’xs’) wav = wave.open(StringIO.StringIO(wavs)) print wav.getnchannels(), wav.getframerate(), wav.getnframes()

result:

1 16000 21520

Requirements

  • Python 2.7

  • MaryTTS server running

License

My own code is Apache-2.0 licensed unless otherwise noted in the script’s copyright headers.

Author

Guenter Bartsch <<guenter@zamia.org>>

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

py-marytts-0.1.4.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

py_marytts-0.1.4-py2.py3-none-any.whl (6.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file py-marytts-0.1.4.tar.gz.

File metadata

  • Download URL: py-marytts-0.1.4.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py-marytts-0.1.4.tar.gz
Algorithm Hash digest
SHA256 17a5211b38b0005747c1cab69190604a80a359ce7f779de915594b2816991ec8
MD5 4a1c385849cc23558e4362e2333bba2a
BLAKE2b-256 cd3f0ea997336367ea204b2e48cb6bc5cd60c602c3f93e422cc4cee5e8ee10b8

See more details on using hashes here.

File details

Details for the file py_marytts-0.1.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for py_marytts-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dbe058d38acb4751b3a25c8ab8940723ae3fd8ac82f9a6ee3cf0f906338d2258
MD5 d507ce6881f03f1aae4b995b1e995a7d
BLAKE2b-256 6a97b01d0eaf74b18cce1cbf67f9b1939d7f248e20486563eab37e4128edfee4

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