Code Monkey home page Code Monkey logo

espeak-cgi's Introduction

espeak-cgi

This CGI script (written in Tcl) is a wrapper around espeak-ng tool. It is useful if you need a TTS engine for your web app and you want to host it yourself, right on your server.

SCRIPT DOES NOT WORK ON WINDOWS

Installation on RedHat Enterprise 8

Downlad and install ActiveTcl 8.6 from ActiveState into /opt/ActiveTcl-8.6: http://downloads.activestate.com/ActiveTcl/releases/8.6.9.0/

Copy over say.tcl to /var/www/cgi-bin, then chmod it to make it executable.

Obviously, also install espeak-ng (it is already preinstalled if you have GNOME installed).

Usage

The script accepts the following arguments:

  • text=[text encoded in base64] - specifies the text to speak. The value must be the base64 of the string with + replaced with - and / replaced with _ (http base64). Useful if you are trying to speak text the language of which is other than English.

  • textp=[English text] - specifies the text to speak. It is not needed to convert it to base64. However, the specified text must be in English, otherwise, this won’t work.

  • voice=[voice] - specifies the voice to use. Default value is en-us.

  • pitch=[number from 0 to 100] - specifies espeak pitch. Default value is 78.

The script throws only two types of HTTP errors - 200 and 500. When 200 is returned, this means that everything is fine and the resulting wav file is returned. Otherwise, the text of the error is returned.

Example

Contents of index.html:

<script>
function sayHi() {
	let txt = document.getElementById('tbox').value;
	let base = btoa(txt).replace('+', '-').replace('/', '_');
	new Audio('/cgi-bin/say.tcl?text=' + txt + '&v=en-us').play()
}
</script>
<p>Type something: <input type=text id=tbox /></p>
<button onclick="sayHi()">Say it</button>

License

As always, MIT License

espeak-cgi's People

Contributors

tenfensw 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.