For Newbie

Friday, 18 November 2011

How to Easily Create Text To Speech Application Language English (TTS Home) using Delphi






In previous articles have discussed how to actually make the application TextToSpeech English, but it turns out the way it is too difficult actually to make it we could use a more easy way longer and shorter code.

For info this application I created in Borland Delphi 7 and Operating System MS Windows XP SP 2 without installing any component.

Both are now open your Delphi and create a new project.
1. In unit 1 uses clause add ComObj; right under clause Implementation
2. Then make a global variable declarations SpVoice: Variant; on kalusa var or just above clause implementation

Here is a snippet of code header of Unit1



public
{Public declarations}
end;

var
Form1: TForm1;
SpVoice: Variant;

implementation
ComObj uses;

{$ R *. dfm}

Create a procedure OnCreate of the form (do double-click Form1 then you will be brought to the code editor window) until the complete code for this procedure as follows:

TForm1.FormCreate procedure (Sender: TObject);
begin
SpVoice: = CreateOleObject ('SAPI.SpVoice')
end;

Enter on Form Memo and Button components are located on the Component Palette tab standard

Then make the procedure onClick on the Button component (how to double click the Button then you will be brought to the code editor window) until the complete code for this procedure as follows:

procedure TForm1.Button1Click (Sender: TObject);
begin
SpVoice.Speak (memo1.Text)
end;

Then run it by pressing F9. Done.

Testing. Enter the text in English on memo1 and press Button1. then your application can talk. How much easier is not it?

If there is an easy to make trouble doing?

Share on Facebook
Share on Twitter
Share on Google+

Related : How to Easily Create Text To Speech Application Language English (TTS Home) using Delphi