Text To Speech

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. 

     

We receive a few cents from each purchase.  Thanks

 


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Mensa® Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa® 365 Puzzlers  Calendar 2017

Mensa® 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

 

Problem Description

Here's a sample program that will interface with a Microsoft's text-to-speech engine to allow your your Delphi programs to  "speak"  text in any one of several voices.    

Background & Techniques

A viewer recently asked for help in getting his program to speak text through his sound card.  I'm far from an expert in this area but I did find a sample program that will do the job.  A fellow named Chen Yu had posted the programs on Torry's Delphi website of downloadable Delphi programs.  Torry is a great resource for programs - those labeled FWS are freeware with source and are the most useful for our purposes.  Neither the website nor email address included in the source code seem to be currently accessible.   The program I found is called "Monster Speech"  and includes a Speech  SAPI (Sound Application Interface) unit from Delphi Project Jedi,  Speech  knows how to talk with the Microsoft text-to-speech engine included in their older SAPI 4.0 Suite SDK (System Developer's Kit).    

Chen wrote a  MSpeech component to encapsulate the calls to the speech engine through Jedi's Speech unit.    I have an aversion to components not released as part of Delphi, especially non-visual components, mainly because it seems like overkill for the casual user.      So the versions I have posted here are mostly unchanged, except that the Speech and MSpeech units must be added to the project and you must create them in code rather than by dropping the component on a form.  

Confused yet?  Here's a summary of what you will need:

bulletThe Microsoft SAPI 4.0a SDK Suite.   This 38mb file has their text-to-speech engine which you need to install.  The "speech recognition" engine need not be installed.  When installed, the text-to-speech engine will show up as a program which must be started before these Delphi programs will run.      Version 4.0a is not the current version of the SAPI SDK.  You can try the current version (5.0 or 5.1, links from the above page) which includes more features slanted toward online and .NET implementations.   I t seems that units included in these sample only work with the older 4.0 SAPI text-to-speech engine.         
bulletThe latest Speech unit,  sapi.zip,   is still  available at Jedi (including documentation and sample code).    Jedi is a Delphi source site which has done a lot of work collecting various API's translated to Delphi and other components; all with source and all free.  The unit only is included in my downloads below and in the Monster Speech download from  Torry.  
bulletThe MSpeech unit which is included (along with the Speech unit and sample programs) from Torry.  I found them on this Torry page  (you want the program labeled "Monster Speech, Version 1.1.0).  My versions are also included with the downloads below.     

I haven't played with these much, but they do run on my computers.    I did not install the Monster Speech Components.  There are two demo programs that I "converted" by moving the TMSpeech component definition from the Published to the Public section in the code.  This also requires that we create the component ourselves by adding a FormCreate exit with a "Speech:=TMSpeech.create(self);" statement.    The first program, Demo, just reads text you enter in a voice you select.  The second program, DestFile, will write input text in  ".wav" format to a file.   In both cases, the MS Text-to-Speech engine must be installed first.  

If anyone has more information about these demo programs and interface units from Jedi and Mr. Yu, please let me know.    

Frankly, the voices are not that impressive - I downloaded the latest MS SAPI SDK (version 5.1) and voice quality does not to seem to be significantly better.   (The engine with this 5.1 version also does not seem to be recognized by the Jedi Speech API unit, so I assume that the interfaced definition has changed.)    Microsoft's documentation recommends that text to speech be used only for phrases or short text passages.   They go on to explain that "prosody" is the missing element.  "Prosody" is the inflection and tonal changes that make human voices sound human.    

But, for what it's worth, play with this stuff if you want and have some fun exploring text to speech! 

Running/Exploring the Program 

bulletDownload source
bulletDownload  executable

Suggestions for Further Explorations

 Update the Jedi Speech SAPI unit to the current MS SAPI version.  (working through JEDI of course, they are always looking for good Delphi volunteers!)
The  MS SAPI,  JEDI Speech API and Monster Speech downloads all  include voice recognition code, but I did not see any Delphi demo programs, so I'm not sure of the status of this aspect.   

 

Original Date: November 11, 2003 

Modified: May 15, 2018

 
  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright © 2000-2018, Gary Darby    All rights reserved.