GithubHelp home page GithubHelp logo

boltomli / restfulspeak Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 17 KB

Read text from variant TTS backends through REST API

License: Creative Commons Zero v1.0 Universal

Python 100.00%
tts speech restful-api

restfulspeak's Introduction

RESTfulSpeak

Read text from variant TTS backends through REST API

Prerequisite

  • A working espeak or flite installation. Customized binary is supported as well.
  • Python virtualenv is highly recommended.
pip install -r requirements.txt
Vendor Platform Documentation
espeak ['darwin', 'linux', 'win32', 'cygwin'] Offical home page
flite ['darwin', 'linux', 'cygwin'] Offical home page
saypy ['darwin'] Python wrapper script on OS X calling NSSpeechSynthesizer.phonemesFromText
CSSpeak.exe ['win32', 'cygwin'] Sample C# code getting System.Speech.Synthesis.PhonemeReachedEventArgs

Run

python api.py

Test

Open http://localhost:5000/ to view the API document and try it out. Or through CLI:

$ curl -X GET --header 'Accept: application/json' 'http://localhost:5000/speaks/'
[{"name": "espeak", "backend": {"binary": "/usr/local/bin/espeak", "parameters": [{"name": "text", "arg": " ", "type": 0, "required": true}, {"name": "phoneme", "arg": "-x", "type": -1, "required": false}, {"name": "quiet", "arg": "-q", "type": -1, "required": false}], "availability": ["darwin", "linux", "win32", "cygwin"], "info": "http://espeak.sourceforge.net/"}}, {"name": "flite", "backend": {"binary": "/usr/local/bin/flite", "parameters": [{"name": "text", "arg": "-t", "type": -1, "required": true}, {"name": "phoneme", "arg": "-ps", "type": -1, "required": false}, {"name": "quiet", "arg": "-o /dev/null", "type": -1, "required": false}], "availability": ["darwin", "linux", "cygwin"], "info": "http://www.festvox.org/flite/"}}, {"name": "saypy", "backend": {"binary": "vendor/saypy", "parameters": [{"name": "text", "arg": " ", "type": -1, "required": true}, {"name": "phoneme", "arg": " ", "type": -1, "required": false}, {"name": "quiet", "arg": " ", "type": -1, "required": false}], "availability": ["darwin"], "info": "https://github.com/boltomli/RESTfulSpeak"}}]

$ curl -X GET --header 'Accept: application/json' 'http://localhost:5000/speaks/espeak'
{"info": "http://www.festvox.org/flite/", "binary": "/usr/local/bin/flite", "parameters": [{"name": "text", "arg": "-t", "type": -1, "required": true}, {"name": "phoneme", "arg": "-ps", "type": -1, "required": false}, {"name": "quiet", "arg": "-o /dev/null", "type": -1, "required": false}], "availability": ["darwin", "linux", "cygwin"]}

$ curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'text=say%20something' 'http://localhost:5000/speaks/flite'
{"cmd": "['/usr/local/bin/espeak', '-x', '-q', 'say something']", "value": " s'eI s'VmTIN\n"}

Mac only:

$ curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'text=say%20something' 'http://localhost:5000/speaks/saypy'
{"cmd": "['vendor/saypy', 'say something']", "value": "_s1EY _s1UXmTIHN.\n"}

Windows only (also works in cygwin):

$ curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'text=say%20something' 'http://localhost:5000/speaks/CSSpeak.exe'
{"value": "_ s ey s ah m th ih ng _ ", "cmd": "['vendor\\\\CSSpeak.exe', 'say something']"}

TODO

In short, better model/class design.

  • Customizable parameters with checking
  • Audio generation (in BASE64 encoded stream perhaps)

restfulspeak's People

Contributors

boltomli avatar

Stargazers

Jie Lian avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

esoff

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.