As many of you know, it is easy enough to add Text-to-Speech (TTS) or Speech Recognition (SR) to a Delphi application on Vista or Windows 7. Microsoft SAPI 5.x is pre-installed with the OS. (See my CodeRage 4 session (zip) on “Speech Enabling Delphi Applications”)
Regarding TTS, it’s almost true, provided the language you want your application to speak is English or Chinese and, if it’s the case, you can use the Microsoft Anna (very nice) or Lili voices.
But there is still a way to get TTS in other languages without having to buy other 3rd party voices.
This will be included in my session on Delphi Speech for he coming French Online Conference (CodeWay 4) but I thought it worth mentioning here.
You can install Microsoft Speech Server, the speech engine more tailored towards server applications like telephony… It is SAPI compatible (minor differences) and comes with 26 languages to choose from (actually a bit less considering there are 5 English, 3 Chinese, 2 Spanish, 2 French).
Update: see my newer post for the v10.2 download links…
Download and install either the runtime (v10.1): http://www.microsoft.com/downloads/en/details.aspx?FamilyID=674356c4-e742-4855-b3cc-fc4d5522c449&displaylang=en or the SDK(v10.1): http://www.microsoft.com/downloads/en/details.aspx?FamilyID=4d36908b-3264-49ef-b154-f23bf7f44ef4&displaylang=en.
Download and install the language(s) of your choice(v10.1): http://www.microsoft.com/downloads/en/details.aspx?FamilyID=f704cd64-1dbf-47a7-ba49-27c5843a12d5&displaylang=en. The French voices are called Hortense and Harmonie (Canadian French).
You can now use the TTS voice with late binding by calling ‘SPEECH.SpVoice’ instead of ‘SAPI.SpVoice’:
StrSAPISpVoice := 'SPEECH.SpVoice'; FVoice := CreateOLEObject(StrSAPISpVoice);
If you want to create components or simply use early binding, you’ll have to import the Type Library from “MSSPS.DLL” instead of “SAPI.DLL” (both appear as Microsoft Speech Object Library). Beware that the Type Library Import will create a unit named SpeechLib_TLB.pas in both cases, thus erasing the previously imported one! Think about renaming and/or saving it with another name. I chose to leave SpeechLib_TLB.pas for SAPI and SpeechLibServer_TLB.pas for MSSPS.
I must say that Hortense is quite good, but not as smooth as Anna, the default SAPI English voice. And, to be honest, I haven’t yet compared Helen, the US English Speech Server voice with Anna. You’ll tell me….