Reputation: 61
I am running this sample of Hello world My code is
private async void Button_Click(object sender, RoutedEventArgs e)
{
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
Windows.Media.SpeechSynthesis.SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Hello World");
var mediaElement = new MediaElement();
mediaElement.SetSource(stream,stream.ContentType);
mediaElement.Play();
}
when I debug it, I get an error:
An exception of type 'System.IO.FileNotFoundException' occurred in SunnahForKids.exe but was not handled in user code
Additional information: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Upvotes: 6
Views: 1684
Reputation:
That is probably because the voice is not installed on the device. To solve it just add a try catch block and it will only "speak" when the voice related to the region and language of your app IS installed. Otherwise it will run without speaking.
Upvotes: 1
Reputation: 116
If you use Dependency walker to view the dependency of system.speech.dll, it would tell you that "Error: Modules with different CPU types were found." Set CPU to be x64 in Visual Studio might solve your problem. It works for me.
Upvotes: 0
Reputation: 241
From the MSDN Reference
Requirements
Minimum supported client: Windows 8.1
Minimum supported server: Windows Server 2012 R2
Minimum supported phone: Windows Phone 8.1 [Windows Runtime apps only]
Namespace: Windows.Media.SpeechSynthesis, Windows::Media::SpeechSynthesis [C++]
Upvotes: 1