what is the difference between SpVoice and SpeechSynthesizer
Asked Answered
I

2

11

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?

Incongruous answered 12/2, 2009 at 9:30 Comment(1)
2017 summary here: webbie.org.uk/blog/microsoft-speechHeadward
B
6

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.

Bijou answered 26/2, 2009 at 3:27 Comment(2)
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)Incongruous
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).Incongruous
G
3

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.

Galitea answered 12/2, 2009 at 9:39 Comment(4)
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.Incongruous
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.Galitea
As I wrote that the XP uses SAPI 5.1 and there also its not able to detect the voice.Incongruous
Sorry, missed that. Let me take a look at System.SpeechGalitea

© 2022 - 2024 — McMap. All rights reserved.