Text-to-speech in a Windows Store app using a speech synthesizer

I am running this sample Hello world My code

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) 
+6
source share
3 answers

From MSDN Link

Requirements

Minimum Supported Client: Windows 8.1

Minimum supported server: Windows Server 2012 R2

Minimum Supported Phone: Windows Phone 8.1 [Windows Runtime Applications Only]

Namespace: Windows.Media.SpeechSynthesis, Windows :: Media :: SpeechSynthesis [C ++]

+1
source

Perhaps this is due to the fact that the voice is not installed on the device. To solve this problem, just add a catch try block, and it will only "speak" when a voice is set that is related to the region and language of your application. Otherwise, it will work without talking.

+1
source

If you use Walker Dependency to view the system.speech.dll dependency, it will tell you that "Error: modules with different types of processors were found." Installing a CPU on x64 in Visual Studio may solve your problem. This works for me.

0
source

All Articles