July 2017
Beginner to intermediate
390 pages
10h 53m
English
Guess what: this is exactly the same code as we have seen before. Surely, there must be something different in this class? Well, there is, and this is it:
public async Task<Stream> GenerateVoiceAsync(string textToSay){ var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer(); var speechVoice = Windows.Media.SpeechSynthesis .SpeechSynthesizer.AllVoices[0]; synth.Voice = speechVoice; var voiceStream = await synth.SynthesizeTextToStreamAsync(textToSay); return voiceStream.AsStreamForRead();}
There you have it: the sample to load audio data asynchronously from a stream. But of course, the important part is the voice-generation component.
I used the SpeechSynthesizer class from the Windows.Media.SpeechSynthesis namespace. ...
Read now
Unlock full access