Je viens d'essayer (D2009 sur Vista Home Premium) avec le code suivant et ça marche!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComObj;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Voice: Variant;
begin
Voice := CreateOLEObject('SAPI.SpVoice');
Voice.speak('Hello World');
end;
end.
Pour votre information, il y a un nice paper on using speech in Delphi programming par Brian Long ...
(très) Mise à jour tardive:
Pour pourquoi il ne fonctionne pas dans Vista et donner une EZeroDivide exception en dehors de l'IDE, voir cette autre question SO: Delphi SAPI Text-To-Speech
merci François. Cela fonctionne avec le composant dans le papier que vous avez suggéré (http://www.blong.com/Conferences/DCon2002/Speech/SAPI51/SAPI51.htm) –