UWP/MVVM: minimal implementation

And barely that. Code


UWP / Speech

Pretty much just screenshots. In practice Speech remains as-is from Phone 8.1 as far as I can see. On this occasion I moved my VSFF to a VM running W10 Enterprise, as you need that for the emulators. However although on a Windows 8.1 install in 2014 I could get the emulator working, this time I could not.

I had not previously grasped that whereas the previous generation of Speech (references e.g. the “Hazel” voice) manage both the speech creation and the audio “rendering”, the new generation (references e.g. the “Susan” voice) does not: typically you can create the speech stream in a non-e.g. XAML context, but to render you typically use MediaElement… which uses a XAML page. Terrible generalisations on my part, but I can see it is probably related to a wish to be SOLID.

Anyhoo, these are the key takeaways for me right now… real simple, but proves the point (what point? 🙂 ). The use of the voice “Susan” in the snippet assumes that you have installed it.

using Windows.UI.Xaml.Controls;
using TextToSpeech;
namespace App1 {
public sealed partial class MainPage : Page
 public MainPage()
 SpeakIt.ReadText("this is a test; oh yes");


using System;
using Windows.UI.Xaml.Controls;
using Windows.Media.SpeechSynthesis;
using System.Linq;
namespace TextToSpeech
 public static class SpeakIt
 private const string PreferredVoice = "Susan";
public static async void ReadText(string mytext) {
 MediaElement mediaPlayer = new MediaElement();
using (var speech = new SpeechSynthesizer()) {
 speech.Voice = SpeechSynthesizer.AllVoices.First(voice => voice.Id.Contains(PreferredVoice));
var x = SpeechSynthesizer.AllVoices.ToList();
 foreach (var item in x) {
 var x1 = item.Description;
 var x2 = item.DisplayName;
 var x3 = item.Gender;
 var x4 = item.Id;
 var x5 = item.Language;
SpeechSynthesisStream stream = await speech.SynthesizeTextToStreamAsync(mytext);
 mediaPlayer.SetSource(stream, stream.ContentType);

This is a useful MVA video on 8.1 (i.e. 10) speech.

Just the screenshots I took while trying to get a result – may of them are very close to those from 1.5 years back, the only difference being Windows 10 now, Windows 8.1 then: