Giter Club home page Giter Club logo

python-espeak's Introduction

python-espeak - Python interface to the espeak text-to-speech CLI program

python-espeak is a simple Python 3 wrapper for the espeak speech synthesizer, which is a fancy way to say that it can make your computer talk.

It's synchronous and meant to be used for scripting, as it's very simple to use but does not involve ctypes and libespeak.so, which would have allowed a greater degree of control at the expense of complexity (something outside the scope of this little project).

I developed this in parallel with a Ruby version as an experiment: with the same goal and a similar (but idiomatic) design, write a (simple) library in two different languages in a single day. I completed the Ruby version in half the time I took for the Python version, even though I have been a Python programmer for longer. This experiment has really given me a clear perspective on the two languages, and will inevitably influence my future projects.

Usage

To install the python-espeak package, make sure you have Python 3 and the espeak programs installed - both of which can be commonly found on distro repositories on GNU/Linux, then type

make install

You can run the test suite by typing make test. Type make for a detailed list of actions.

Using python-espeak is very easy. After importing the package with

import espeak

you can initialize an ESpeak object with

es = espeak.ESpeak(options)

The options argument is not required; python-espeak comes with a lot of defaults ideal for your average English-reading experience.

You can make your computer talk by using

es.say(text)

And you can save the output to a .wav file by using

es.save(text, filename)

Additionally, you can generate an espeak command by using

es.command(text, filename)

The filename is optional and matters only if you want a command to generate a wav file.

espeak is not limited to reading English and has a lot of options. You can see a list of them by typing espeak --help in your terminal and set a lot of them directly from a ESpeak instance, for example

es.voice = 'de'
es.speed = 1

will make your PC sound like an angry German.

You can see a list of the available voices by typing

print(es.voices)

License

All files in this distribution are released under version 3 of the GNU General Public License or any later version, unless otherwise stated.

python-espeak's People

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.