tags:

views:

1306

answers:

3

What is the difference between these two methods in C# using the speech API or SAPI?

using SpeechLib;
SpVoice speech = new SpVoice();
speech.Speak(text, SpeechVoiceSpeakFlags.SVSFlagsAsync);

returns the Apacela voices, and

SpeechSynthesizer ss = new SpeechSynthesizer();
ss.SpeakAsync ("Hello, world");

Does not work with Apacela voices.

The first one return all voices but the second one only return few voices. Is this something related to SAPI 5.1 and SAPI 5.3?

The behavior is same on Vista and XP, on both SpVoice was able to detect the Apacela voice but using SpeechSynthesizer, the voices does not detected on both XP and Vista.

I guess XP uses SAPI 5.1, and Vista uses SAPI 5.3 then why the same behavior on all OS, but different behavior with the API?

Also which API is more powerful and what are the difference between the two ways/API?

+2  A: 

SpeechLib is an interop DLL and so maps to whatever version of SpeechLib it was created for (you can check it's properties).

System.Speech.* is the "official" support for speech in the .NET framework. SpeechSynthesizer chooses which speech library to use at runtime (much like the System.Web.Mail classes did).

I'm not sure why they return a different number of voices but it is likely to be related to the SAPI version being used.

Richard Szalay
edited the question with more description, I hope you would like to share more info, as the problem is not related to runtime, but the API differences.
Priyank Bolia
My guess is that the Apacela voice does not support the new APIs in SAPI 5.3 so System.Speech (with uses 5.3 on Vista) cannot access it. Obviously 5.3 represents what Microsoft will be supporting going forward, but if you need that voice maybe you should use SpeechLib.
Richard Szalay
As I wrote that the XP uses SAPI 5.1 and there also its not able to detect the voice.
Priyank Bolia
Sorry, missed that. Let me take a look at System.Speech
Richard Szalay
+2  A: 

SpeechLib is an Interop DLL that makes use of classic COM-based SAPI under the covers. System.Speech was developed by Microsoft to interact with Text-to-speech (and voice recognition) directly from within managed code.

In general, it's cleaner to stick with the managed library (System.Speech) when you're writing a managed application.

It's definitely not related to SAPI version--the most likely problem here is that a voice vendor (in this case Acapela) has to explicitly implement support for certain System.Speech features. It's possible that the Acapela voices that you have support everything that is required, but it's also possible that they don't. Your best bet would be to ask the Acapela Group directly.

Voices are registered in HKLM\SOFTWARE\Microsoft\Speech\Tokens, and you should see the Windows built-in voices, as well as the Acapela voices that you have added listed there. If you spot any obvious differences in how they're registered, you might be able to make the Acapela voices work by making their registration match that of, for example, MS-Anna.

But I'd say the most likely possibility is that the Acapela voices have not been updated to support all of the interfaces required by System.Speech.

sblom
Thanks for the answer, the Acapela support is junk and didn't answer my questions which I asked them more than 10 days back. The reply I got is:It's a known issue with .NET 3.5 which is not linked to our product.We are waiting for an update from Microsoft (bug linked to TokenEnums not supported)
Priyank Bolia
Changing the registry detects the voices but causes a crash when selecting that voice. So, I am assuming this is a vendor bug only either Microsoft or Acapela (most likely).
Priyank Bolia
A: 

Hello

I am having the exact same problem. However I am unable to circumvent it by using SpeechLib (My software crashes upon instantiating SpVoice giving me a ambiguous "vshost.exe stopped working" error).

Given a year has passed since you had this problem; Has anyone found a way to use Acapela Voices with System.Speech? Maybe some registry hack or something?

Thank you in advance. Best regards, Markus

metter
I stopped supporting the junk Acapela Voices, its Acapela issue, they don't have proper SAPI 5 support and uses stupid license protection scheme, and modifying my software to support a voice that no one buys doesn't make business sense to me.
Priyank Bolia
better follow the SAPI 5 .NET API, which guarantees that your program works great in future too.
Priyank Bolia
Thank you Priyank Bolia for your answer.I have been in contact with acapela support and basically what they're saying is:"If you want full sapi support, then buy our dev kit."Well, this has been the first and last time I bought an Acapela product.Cheers, Markus
metter