Giter Site home page Giter Site logo

espeakng-python's Introduction

eSpeak NG TTS Bindings for Python3

Copyright 2016-2020 Sayak B. Licenced under GNU GPLv3.

Python Version Linux Windows FOSSA Status

Requirements

You need to have eSpeak NG installed in your system and added to the path.

Windows

The latest installers for eSpeak NG can be found here.

The installed executable may need to be added to the system path. (See here)

Ubuntu & Debian

sudo apt-get update
sudo apt-get install espeak-ng

Others

If eSpeak NG is not available in your package manager, you may need to compile the binaries for your system. Refer to this page for more information.

Installation

PyPi

This library is available on PyPi.

pip install espeakng

GitHub Releases

You can download the latest release for this library here.

Usage

First, we have to initialize a Speaker.

import espeakng

mySpeaker = espeakng.Speaker()

And then use the Speaker.say() method to speak:

mySpeaker.say('Hello, World!')

Calling Speaker.say() will interrupt any ongoing output from the same object immediately.

Use the following code if you wish to wait for any ongoing speech to complete:

mySpeaker.say('I am a demo of the say() method.', wait4prev=True)

Changing speech properties

Pitch

By default the pitch is set at 80.

Change it by:

mySpeaker.pitch = 120

Words per Minute (WPM)

By default WPM is set at 120.

Change it by:

mySpeaker.wpm = 140

Voice

By default the voice is set to 'en'. The complete list of supported voices can be found here.

Change it by:

mySpeaker.voice = 'es'

Export to .WAV file

By default, your text will just be spoken aloud, but if you want it to be written to a .WAV file, you can specify an export_path when calling the say function, as seen below:

mySpeaker.say("Export this to a file", export_path="test.wav")

Special thanks

  • MickeyDelp for wordgap and amplitude controls, and other helper methods.
  • FlorianEagox for the export to WAV file feature.

espeakng-python's People

Contributors

florianeagox avatar fossabot avatar mickeydelp avatar restyled-commits avatar restyled-io[bot] avatar sayak-brm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

espeakng-python's Issues

FileNotFoundError: [Errno 2] No such file or directory on Linux

Running test.py with correct permissions set to necessary file the following error occurs:

$ python3 test.py
Testing espeak4py
Testing wait4prev
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    mySpeaker.say('Hello, World!')
  File "/home/travis/build/sayak-brm/espeak4py/espeak4py/__init__.py", line 35, in say
    self.prevproc = subprocess.Popen(cmd, executable=self.executable, cwd=os.path.dirname(os.path.abspath(__file__)))
  File "/opt/python/3.5.2/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/opt/python/3.5.2/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/home/travis/build/sayak-brm/espeak4py/espeak4py/espeak'

Issue on StackOverflow: http://stackoverflow.com/questions/39785140/subprocess-popen-oserror-errno-2-no-such-file-or-directory-only-on-linux

How to Download?

Hey, i want to use this library for one of my projects, however ive never used a github library. Could you please let me know how i download this library?

Thanks

[FOSSA] Issue with espeakng-python - POLICY_FLAG

POLICY_FLAG - espeakng-python (3056b6c)

Component URL

https://github.com/sayak-brm/espeakng-python

Affected Projects

  • espeakng-python

Issue

Your policy has flagged the conflicting licenses for review.

Licenses found by FOSSA

  • GNU General Public License v3.0 only
  • GNU General Public License v3.0 or later

Generated by FOSSA on 07/12/2020
Reported Issue: https://app.fossa.com/projects/git%2Bgithub.com%2Fsayak-brm%2Fespeakng-python/refs/branch/master/249bedebb71ec80f62f08519aedadfa0512798d8/issues/licensing/388333?filter=policy_flag&revisionScanId=2454707&status=any

Add support to export to WAV?

Is your feature request related to a problem? Please describe.
I need to be able to export some text made by espeak to a wav file for my repo

Describe the solution you'd like
Add a parameter to the say function which would add a -w "path" argument to the command which would tell the binary to save the file.

Describe alternatives you've considered
On linux you could just tell it redirect the output with `espeak "hello" > hello.wav"

Additional context
I can submit a PR to do this right now if the project is still active, and you'll accept it for a new Pypi release. I'd also like to add a function that just prints all the supported languages from the table linked in your readme.
e.g.

def list_voices():
    return ["af","sq","am","ar","an","hy","hyw","as","az","ba","cu","eu","be","bn","bpy","bs","bg","my","ca","chr","yue","hak","haw","cmn","hr","cs","da","nl","en-us","en","en-029","en-gb-x-gbclan","en-gb-x-rp","en-gb-scotland","en-gb-x-gbcwmd","eo","et","fa","fa-latn","fi","fr-be","fr","fr-ch","ga","gd","ka","de","grc","el","kl","gn","gu","ht","he","hi","hu","is","id","ia","io","it","ja","kn","kok","ko","ku","kk","ky","la","lb","ltg","lv","lfn","lt","jbo","mi","mk","ms","ml","mt","mr","nci","ne","nb","nog","or","om","pap","py","pl","pt-br","qdb","qu","quc","qya","pt","pa","piqd","ro","ru","ru-lv","uk","sjn","sr","tn","sd","shn","si","sk","sl","smj","es","es-419","sw","sv","ta","th","tk","tt","te","tr","ug","ur","uz","vi-vn-x-central","vi","vi-vn-x-south","cy"]

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.