delphi - Text to speech in Vista -
i did creating ole object delphi in 2000/nt/xp following:
voice := createoleobject('sapi.spvoice'); voice.speak(...)
but not work in vista, how can make program speak text in vista?
i tried (d2009 on vista home premium) following code , works!
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.
fyi, there nice paper on using speech in delphi programming brian long...
(very) late update:
for why might not work in vista , give ezerodivide exception outside ide, see other question: delphi sapi text-to-speech
Comments
Post a Comment