2

I'm from Greece and I want to make an application which will use SAPI to interact with the user, but I can't find a way to change the language of SAPI from English to Greek.

My OS is by default Greek & English, and I have SAPI SDK installed; the Greek Language is supported by SAPI.

The problem is that SAPI doesn't automatically recognise the language passed to it, and reverts to saying the individual letters one-by-one.

Here is the code I'm using, with English text:

using SpeechLib; SpVoice voice = new SpVoice(); voice.Speak("Pdf File Successfully Installed", SpeechVoiceSpeakFlags.SVSFlagsAsync); voice.WaitUntilDone(30000); 

This works, but when I pass Greek text to the function (eg "Να ενα κειμενο"), I see the problem occur.

7
  • 1
    So you're having trouble with the Text To Speech side, rather than the recognition side? Commented Apr 20, 2015 at 12:28
  • @JamesThorpe I dont really know whose fault is..:/ Commented Apr 20, 2015 at 12:29
  • You could use Speech XML to note the languages inline... Commented Apr 20, 2015 at 14:55
  • Alternatively you may want to set the Voice to a greek voice. Commented Apr 20, 2015 at 14:56
  • @Ben Thanks for answering Ben.. Can you explain in more depth how can I do that? Commented Apr 20, 2015 at 16:07

1 Answer 1

1

You can set a language by passing SSML to the Speak API, and including the xml:lang attribute.

For example this should work:

SpVoice voice = new SpVoice(); voice.Speak( "<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='el-GR'>" + "Να ενα κειμενο" + "</speak>", SpeechVoiceSpeakFlags.SVSFlagsAsync|SpeechVoiceSpeakFlags.SVSFIsXML); voice.WaitUntilDone(30000); 

You can also switch language mid-speech. The documentation has this example:

<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"> For English, press 1. <voice xml:lang="fr-FR" gender="female"> Pour le français, appuyez sur 2 </voice> </speak> 

For more, see here:

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks so much Ben.Solution 1 seems to be pretty nice, but im getting an error while trying to run it
You are missing your close tag </speak>
Oh I'm so dump..I will give it a try,And I will reply soon!
As I have seen in Microsoft's site , can I use Lang ID in the SSML? Is this changing, the xml:lang="el-GR" tag. For example, instead of "el-GR", I shall use 408 (Greek Id lang) ?
Sorry yes, it should be "el" or maybe "el-GR" not "gr-GR". I don't know if you can use 408, sorry.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.