Sumber Kode

Programmatically talk using Microsoft Sam

  • delphibasics
  • Nov 19' 14
  • Delphi
  • 117
  • 284
  • United States
Text to speech: programmatically talk using Microsoft Sam.  Speech synthesis works on any operating system which has SAPI DSK installed since it uses Microsoft Speech API.

In a formed application:

uses
  COMobj

procedure TForm1.Button1Click(Sender: TObject);
var
  voice: OLEVariant;
begin
    voice := CreateOLEObject('SAPI.SpVoice');
    voice.Speak('This is Microsoft Sam saying Delphi Basics', 0);
end;

In a formless application:
program Project1;

uses
  COMobj,
  ActiveX;

var
  voice: OLEVariant;

begin
    if paramstr(1) = '' then exit;
    try
      CoInitialize(nil);
      voice := CreateOLEObject('SAPI.SpVoice');
      voice.Speak(paramstr(1), 0);
    Finally
      CoUnInitialize;
    end;
end.

To display the voice that is speaking [Microsoft Sam]
ShowMessage(voice.voice.getdescription(0));

To read more on Speech Synthesis & Speech Recognition Using SAPI 5.1,visit: http://edn.embarcadero.com/article/29583.

Delphi source code of projects hosted by the article above are mirrored below.
Instructions are including for compiling on Delphi 2007.



Only Delphi source code is included in the archive.

Powered by
Pasar Kode Partner

Share

  • Tags :
comments powered by Disqus

Kode Terkait

Modify TEdit to include text alignment

Delphi RC4 Encryption Source Code

Update PE CheckSum

Enumerate Processes using Native Windows API

Self-Deleting File - "Melting"

Change ImageBase of a PE File

Reduce the units included in the uses

Numbers to Words - 1 to one; 2 to two; 22 to twenty-two; etc.

How to turn the monitor on and off



Kategori