Sign in Join
Wiki copytemporary

espeak: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: espeak

OldNewLine
1+## Overview
2+
3+[eSpeak](http://espeak.sourceforge.net/) is an open source Text-To-Speech (TTS) engine. It is an artificial speech synthesis software which converts text to audio. It supports a vast number of [languages](http://espeak.sourceforge.net/languages.html). Further languages can be developed with the help of [espeakedit](http://espeak.sf.net/download.html), a GUI interface for preparing and compiling phoneme data. In Windows, eSpeak implements Microsoft [[SAPI]] (Speech API). Besides Windows, it supports Mac and Linux platforms.
4+
5+eSpeak does text to speech synthesis for the following languages, some better than others: Afrikaans, Albanian, Aragonese, Armenian, Bulgarian, Cantonese, Catalan, Croatian, Czech, Danish, Dutch, English, Esperanto, Estonian, Farsi, Finnish, French, Georgian, German, Greek, Hindi, Hungarian, Icelandic, Indonesian, Irish, Italian, Kannada, Kurdish, Latvian, Lithuanian, Lojban, Macedonian, Malaysian, Malayalam, Mandarin, Nepalese, Norwegian, Polish, Portuguese, Punjabi, Romanian, Russian, Serbian, Slovak, Spanish, Swahili, Swedish, Tamil, Turkish, Vietnamese, Welsh.
6+
7+Lazarus or Freepascal has many ways of implementing it. The simplest way is to use an [sysutils.ExecuteProcess()](http://www.freepascal.org/docs-html/rtl/sysutils/executeprocess.html) call to execute eSpeak with command line parameters ([[espeak|discussed below]]). But this could result in a console window while speaking. A better solution is to use a TProcess (changing properties to poUsePipes and swoHide) to run the commands.
8+
9+## Using eSpeak command line
10+
11+These are some simple examples of using the eSpeak command line. To use this [Download](http://espeak.sourceforge.net/download.html) and install eSpeak. Then open the command prompt and run `cd C:\Program Files\eSpeak\command_line\` then run the commands below:
12+
13+```dos
14+espeak "Hello World!"
15+```
16+
17+This is the simplest command. Speaks "Hello World!"
18+
19+```dos
20+espeak -v +f2 "Hello World!"
21+```
22+
23+Speaks the text in female voice (thus f2). There are 7 male voices (m1 to m7) and 4 female voices (f1 to f4)
24+
25+```dos
26+espeak -v fr+f2 "Bonjour tout le monde"
27+```
28+
29+Speaks the text in French accent and in a female voice.
30+
31+```dos
32+espeak -g 10 "I have something to say."
33+```
34+
35+Pauses for 10 milliseconds between words. A better understandable option.
36+
37+```dos
38+espeak -s 400 "I have something to say."
39+```
40+
41+Speaks fluently! The -s (speed) parameter could be 80 to 450. Default is 175.
42+
43+```dos
44+espeak -v +whisper "I have something secret to say!"
45+```
46+
47+Speaks the text as if in your ear!! (Notice the `+whisper` part.)
48+
49+More details about command line parameters can be found here: <http://espeak.sourceforge.net/commands.html>
50+
51+## Preparing to use eSpeak
52+
53+We can either use the installation path of eSpeak (path is retrieved from the Windows registry) or use a stand alone option (by using a copy of the installation directory). Example of the former can be found [here](http://www.rolfware.de/delphi/espeak_example.html) (for Delphi). For the rest of this article we will use the stand-alone option (by using `--path` parameter).
54+
55+To get the stand-alone flavor of eSpeak we will have to do the following:
56+
57+1. [Download](http://espeak.sourceforge.net/download.html) and install eSpeak for windows. The file would be named something like: espeak-1.46.02-win.zip
58+2. Assuming that you have installed eSpeak in `C:\Program Files\eSpeak` , copy the eSpeak directory in your freepascal/lazarus project directory.
59+3. You may remove some unwanted files or folders such as sourcedict, espeaksapi.dll etc. if you want.
60+4. Optionally, you may uninstall eSpeak (if you don't want to use the eSpeak installation).
61+
62+Now remember to add `--path` parameter when calling eSpeak. For example:
63+
64+```dos
65+espeak.exe --path=eSpeak "Hello World!"
66+```
67+
68+## Coding for Free Pascal
69+
70+Free Pascal can be used to call the eSpeak command line executable to retrieve spoken words. A simple example is given below:
71+
72+``` pascal
73+uses sysutils
74+
75+...
76+
77+var
78+ ExePath,MyText:String;
79+begin
80+ ExePath := 'path\to\espeak\command_line\espeak.exe';
81+ MyText := 'Hello World!';
82+
83+ ExecuteProcess(ExePath, ' --path=eSpeak "' + MyText + '"', []);
84+```
85+
86+Here only `--path` parameter is used. There are other parameters that can speak a text file; set the volume, pitch, speed (words per minute), word gap etc. Info about command line parameters can be found here: <http://espeak.sourceforge.net/commands.html>
87+
88+## Coding for Lazarus
89+
90+For a tutorial, please see here: <http://www.lazarus.freepascal.org/index.php/topic,20153.0.html> Or here: <http://inkoflife.blogspot.com/2013/03/let-your-software-speak.html>
91+
92+## See also
93+
94+- [[Speech Synthesis]] for cross-platform and native operating system speech synthesis solutions.
95+
96+---
97+*From the Free Pascal wiki, page "espeak", as it stood on 2019-12-19 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
98+Category: FPC
99+Category: Speech synthesis
100+Category: Tutorials

Back to history