GithubHelp home page GithubHelp logo

hyansuper / py-espeak-ng Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gooofy/py-espeak-ng

0.0 0.0 0.0 20 KB

Some simple wrappers around eSpeak NG intended to make using this excellent TTS for waveform and IPA generation as convenient as possible.

License: Apache License 2.0

Makefile 4.04% Python 95.96%

py-espeak-ng's Introduction

py-espeak-ng

Some simple wrappers around eSpeak NG 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 eSpeak NG as-is for speech synthesis in their Python application on GNU/Linux operating systems.

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

Examples

Direct TTS Audio Output

First, import the ESpeakNG engine wrapper:

from espeakng import ESpeakNG

now for some simple direct TTS output:

esng = ESpeakNG()
esng.say('Hello World!')

lower pitch and speed:

esng.pitch = 32
esng.speed = 150
esng.say('Hello World!')

try a different language:

esng.voice = 'german'
esng.say('Hallo Welt!')

specify phonemes instead of words:

esng.voice = 'english-us'
esng.say("[[h@l'oU w'3:ld]]")

Synthesize Wave File without Playing It

From Text:

import wave
import StringIO

esng.voice = 'english-us'
wavs = esng.synth_wav('Hello World!')
wav = wave.open(StringIO.StringIO(wavs))
print wav.getnchannels(), wav.getframerate(), wav.getnframes()

result:

1 22050 24210

List Available Voices

l = esng.voices

result:

>>> l[0]
{'pty': '5', 'language': 'af', 'gender': 'M', 'age': '--', 'voice_name': 'afrikaans', 'file': 'gmw/af'}
>>> l[1]
{'pty': '5', 'language': 'am', 'gender': '-', 'age': '--', 'voice_name': 'amharic', 'file': 'sem/am'}
>>> l[2]
{'pty': '5', 'language': 'an', 'gender': 'M', 'age': '--', 'voice_name': 'aragonese', 'file': 'roa/an'}
...

Grapheme to Phoneme (G2P) Conversion

ipa = esng.g2p ('Hello World!', ipa=2)

result:

>>> print ipa
həlˈo͡ʊ wˈɜːld

Requirements

  • Python 2 or 3

  • espeak-ng binary installed and in PATH

License

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

Author

Guenter Bartsch <[email protected]>

py-espeak-ng's People

Contributors

gooofy avatar hyansuper avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.