开发者

Localizing SAPI Text-To-Speech to spanish

I have managed to use SAPI Text-To-Speech in Delphi/Lazarus by using the following code:

procedure TForm1.Button1Click(Sender: TObject);
var
  SpVoice: Variant;
begin
  SpVoice := CreateOleObject('SAPI.SpVoice');
  SpVoice.Speak('Hello World!', 0);
end;  

This code automatically chooses an english standard voice. Since I need to localize it to spanish I investigated if my system (Windows XP with standard Spanish) had a spanish voice or I needed to install it, and how to change the default voice, but no luck so far. Therefore my questions are:

开发者_如何学Go
  1. How can I know if my system already has a spanish voice installed or I need to install it?
  2. Supposing I have the voice I need installed, how can I make SAPI use that voice instead of the standard one?

I am guessing I can get a spanish voice by using following code (C0A is the code for spanish language):

SpVoice.GetVoices('','Language=C0A').Item(0)

but do not know how to set the voice to be used.

EDIT: to avoid confusions, I need to make this compatible with Delphi and Lazarus, being the last one the primary development tool.


No freely available version of SAPI comes packaged with a Spanish voice. SAPI 5.1 for XP comes with a Chinese and English voice; SAPI 5.3 and SAPI 5.4 have only English voices installed.

You can purchase a Spanish voice from Cepstral (among other vendors) that will work for any version of SAPI 5. (I have not used these voices, so I cannot vouch for the quality of these voices.)


Install Microsoft Speech Server, and follow these hints by Francois Gaillard.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜