We don't display ads so we rely on your Bitcoin donations to 1KWEk9QaiJb2NwP5YFmR24LyUBa4JyuKqZ
Post date: Mar 12, 2010 12:46:37 AM
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 COMobjprocedure 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.