Difference between revisions of "espeak"
(Created page with "== Overview == eSpeak is a text-to-speech (TTS) engine. It converts text to audio. == Sample == to do fill in Category:FPC Category:Tutorials") |
(Basic Article submitted) |
||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
− | eSpeak is | + | [http://espeak.sourceforge.net/ eSpeak] is an open source Text-To-Speech (TTS) engine. It is an artificial speech synthesis software which converts text to audio. |
− | == | + | Lazarus or Freepascal has many ways of implementing it. The simplest way is to use [http://www.freepascal.org/docs-html/rtl/sysutils/executeprocess.html sysutils.ExecuteProcess()] call to execute eSpeak with command line parameters. |
− | to do | + | |
+ | |||
+ | == Preparing to use eSpeak == | ||
+ | We can either use the installation path of eSpeak (path is retrieved from windows registry) or use a stand alone option (by using a copy of the installation directory). Example of the former can be found [http://www.rolfware.de/delphi/espeak_example.html here] (for Delphi). For the rest of this article we will use the stand-alone option (by using --path parameter). | ||
+ | |||
+ | To get the stand-alone flavor of eSpeak we will have to do the following: | ||
+ | # [http://espeak.sourceforge.net/download.html Download] and install eSpeak for windows. The file would be named something like: espeak-1.46.02-win.zip | ||
+ | # Assuming that you have installed eSpeak in <code>C:\Program Files\eSpeak</code> , copy the eSpeak directory in your freepascal/lazarus project directory. | ||
+ | # You may remove some unwanted files or folders such as sourcedict, espeaksapi.dll etc. if you want. | ||
+ | |||
+ | Now remember to add <code>--path</code> parameter when calling eSpeak. For example: | ||
+ | |||
+ | <syntaxhighlight lang="dos"> | ||
+ | espeak.exe --path=eSpeak "Hello World!" | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == Coding for Freepascal == | ||
+ | <syntaxhighlight lang="pascal"> | ||
+ | uses sysutils | ||
+ | |||
+ | ... | ||
+ | |||
+ | var | ||
+ | ExePath,MyText:String; | ||
+ | begin | ||
+ | ExePath := 'path\to\espeak\command_line\espeak.exe'; | ||
+ | MyText := 'Hello World!'; | ||
+ | |||
+ | ExecuteProcess(ExePath, ' --path "' + MyText + '"', []); | ||
+ | end; | ||
+ | </syntaxhighlight> | ||
[[Category:FPC]] | [[Category:FPC]] | ||
[[Category:Tutorials]] | [[Category:Tutorials]] |
Revision as of 06:00, 7 March 2013
Overview
eSpeak is an open source Text-To-Speech (TTS) engine. It is an artificial speech synthesis software which converts text to audio.
Lazarus or Freepascal has many ways of implementing it. The simplest way is to use sysutils.ExecuteProcess() call to execute eSpeak with command line parameters.
Preparing to use eSpeak
We can either use the installation path of eSpeak (path is retrieved from windows registry) or use a stand alone option (by using a copy of the installation directory). Example of the former can be found here (for Delphi). For the rest of this article we will use the stand-alone option (by using --path parameter).
To get the stand-alone flavor of eSpeak we will have to do the following:
- Download and install eSpeak for windows. The file would be named something like: espeak-1.46.02-win.zip
- Assuming that you have installed eSpeak in
C:\Program Files\eSpeak
, copy the eSpeak directory in your freepascal/lazarus project directory. - You may remove some unwanted files or folders such as sourcedict, espeaksapi.dll etc. if you want.
Now remember to add --path
parameter when calling eSpeak. For example:
espeak.exe --path=eSpeak "Hello World!"
Coding for Freepascal
uses sysutils
...
var
ExePath,MyText:String;
begin
ExePath := 'path\to\espeak\command_line\espeak.exe';
MyText := 'Hello World!';
ExecuteProcess(ExePath, ' --path "' + MyText + '"', []);
end;