This is the error message i keep getting on this line when I try to run:
recognitionEngine.LoadGrammar(GrammarBuilder());
Error:
The language for the grammar does not match the language of the speech recognizer.
I have searched high and low for this but I cannot seem to find an answer!
I have two language options in the speech recognition property:
Microsoft Speech Recognizer 8.0 for Windows (English - UK)
Microsoft Speech Recognizer 8.0 for Windows (English - US).
My code will only work if I set the settings to English - US.
Is there a hidden setting on Microsoft Visual C# 2010 Express that would let me change it from US to UK?
I would assume you will need to have your systems language set to EN-US for you to use the Microsoft Speech Recognizer 8.0 for Windows (English - US) option, as would the EN-UK system language, you will need to use the Microsoft Speech Recognizer 8.0 for Windows (English - Uk) option.
Related
I have installed two languages for speech in setup windows 10 pro (Italian and English).
However c# System.speech can only see one recognizer : Microsoft Speech Recognizer 8.0 for windows (English-US) .
I tried to uninstall - install both packages several times .
I call MSFT support ...they told me there is a bug in the last update.
I tried to remove last update (and several others) but still problem not solved.
What else can I try ?
Thanks,
I tried to change the speaker, but i dont have enlisted all installed speakers (George, Susan, Jakub) in SpeechSynthesizer class, on the other hand I have one, that is not installed at all (Zira).
What is happening here ? Can i somehow add specific speaker into my project (for example as .dll or something) to be not dependent on computer language/region ?
UPDATE
As #Jimi mentioned, System.Speech and Microsoft.Speech are different and to avoid confusion, using only one of them should be the right choice.
For System.Speech
Go to Settings/Region and Language/Add Language
From Settings of the language, download Speech
For example Helen is in en_US package. So, the additional Speech should be downloaded by adding English (United States) language.
For Microsoft.Speech
Download a speech from the link below
Add a reference to the
Microsoft.Speech DLL in the project
Microsoft Speech Recognition and Text-to-Speech engine data files can be downloaded from the link below;
Speech Recognition and Text-to-Speech Engines for Microsoft supported Languages https://www.microsoft.com/en-us/download/details.aspx?id=27224
For further information:
Microsoft Speech Programming Guide
https://learn.microsoft.com/en-us/previous-versions/office/developer/speech-technologies/hh378466(v%3doffice.14)
SpeechSynthesizer.SelectVoice Method
https://learn.microsoft.com/en-us/previous-versions/office/developer/speech-technologies/dd167624(v%3Doffice.14)
System.Speech.Synthesis Namespace
https://learn.microsoft.com/en-us/dotnet/api/system.speech.synthesis?view=netframework-4.7.2
I'm running Windows 10 and Visual Studio 2017.
When I check what voices that are available I only get Zira and David from Visual Studio when building a WPF app.
When I check when building a UWP app I get Bengt!
When I check in Windows 10 I only have Bengt (a Swedish one).
Is there a way I can get Bengt in to WPF if not how do I add language and voice into WPF when running Windows 10?? WPF does not get the voices installed in Windows 10!!??
Regards,
I'm trying to use System.Speech.Synthesis; with french female voice, but still got english male.
SpeechSynthesizer synth = new SpeechSynthesizer();
synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult, 0,
new System.Globalization.CultureInfo("fr-FR"));
synth.Speak("bonjour le monde");
I did not installed nothing yet, just added reference system.speech, so now I found this to download and install:
https://www.microsoft.com/en-us/download/details.aspx?id=27224
but first of all I need to know if I can use it with different languages for executable for other users, not sure how it works with different languages
also I need to install
https://www.microsoft.com/en-us/download/details.aspx?id=27225
and there is two:
For the Runtime, please download the Microsoft Speech Platform - Runtime 11
x86_SpeechPlatformRuntime\SpeechPlatformRuntime.msi
and
x64_SpeechPlatformRuntime\SpeechPlatformRuntime.msi
which says:
The Microsoft Speech Platform Runtime contains both a managed (.NET) and native (COM) API for developing Server based speech applications.
So if my system 62-bit, which I have to install to make it available for other users, or I have to install it only according to my system x86
and another:
For the Software Development Kit, please download the Microsoft Speech Platform - SDK 11
https://www.microsoft.com/en-us/download/details.aspx?id=27226
This software development kit contains the documentation, development resources, tools and samples for development of speech applications that utilize the Microsoft Speech Platform Runtime 11.
So what the difference if I want use it for application executable?
I just downloaded the fr-FR runtime language pack so that I can recognize French speech through my program.
However, my program throws the error
Additional information: No recognizer of the required ID found.
at
SpeechRecognitionEngine recognizer =
new SpeechRecognitionEngine(new System.Globalization.CultureInfo("fr-FR"));
en-US and en-GB works because they are pre-installed with my system, I just installed these new language packs but they are still throwing this exception.
Also, if this helps, when I do
foreach (var x in SpeechRecognitionEngine.InstalledRecognizers())
{
Console.Out.WriteLine(x.Name);
}
it prints
MS-1033-80-DESK
EDIT: This is not a possible duplicate because this isn't about having no recognizers installed, it's about C# SAPI not seeing that I have the installed pack for the current language
I was able to get this to work... there is an extra step involved.
Since you're using System.Speech, it uses the installed Desktop speech recognition that comes with Windows. The error you're getting is not because you don't have the language installed, but because you didn't install the speech recognizer for that language.
So, head on over to Setting > Time and Language > Region and language (which is probably where you installed the language from). After you install the language, select the language, and click 'Options'. You should see options to download the language pack, spell checking, and the one we're interested in, Speech. Click Download, and wait for the download/install to finish.
Once it's done, you won't get a notification, but you can go into Settings > Time and Language > Speech and see your installed recognizers there, or you can go to Settings > Speech Recognition > Advanced Speech Options to see the same list.
Now when you run your program, it should work. BTW, if you want to see the installed speech recognizers in your code, use this instead:
foreach (var x in SpeechRecognitionEngine.InstalledRecognizers())
{
Console.WriteLine(x.Culture.Name);
}
You only get a code when asking for the recognizers name, you want the culture's name. (as you saw, MS-1033-80-DESK corresponds to en-US. For reference, fr-FR is MS-1036-80-DESK).
Is it possible that you installed the Microsoft Speech Platform French language pack? Such as the ones seen here? MS Speech Platform Language Packs
If that's the case then it won't appear as an installed language for what you're doing. To get it to work, from what I understand, you will need a language pack installed for French instead which is only available for Windows Ultimate and Enterprise editions if you're using a non-French version of windows.
If that's impossible, then you might have to figure out how to use the Microsoft Speech Platform SDK vs Windows/SAPI. Right now it seems like you're trying to use Windows/SAPI with a Speech Platform Recognizer. Here's the MS page the shows the difference between the MS Speech Platform vs. Windows/SAPI