Speech Synthesis in 2 lines of code
One of my favourite namespaces in the .NET Framework is the System.Speech namespace.
Contained within is powerful functionality to enable both Speech Synthesis (Speaking) and Speech Recognition (Listening) by a .NET application.
In this post, i'd like to highlight just how easy it is to make a Console Application 'Speak' and mention that I aim to provide a series of simple lessons showcasing the Speech Synthesis and Speech Recognition capabilities of the .NET Framework (similar to how I am demonstrating ArKit in Xamarin at XamarinArkit.com) eventually at the website..
System-Speech.com.
Anyway, step 1 is to add a reference to the System.Speech assembly.
Then using the System.Speech.Synthesis.SpeechSynthesizer class, call the .Speak() method.
Simples..
That's it. If you run it, you should hear the text "This is a test" spoken.
In fact the same could be achieved with a single line.
Whilst this example is extremely limited and simple, the SpeechSynthesizer enables you to do a range of different things including using different voices and even saving the output to a .wav file. I hope to show these features in future posts.
You can imagine the cool amazing things you could create if you enable a program to listen and respond to your requests and unlike Alexa skill development, can be done offline and with greater flexibility.
Imagine creating applications and products that people with mobility or sight impairments could interact with using only their voice. The System.Speech namespace could help you achieve that,
So much in fact that I like the .NET System.Speech namespace that I have even proposed a talk on it at DDD North in February. If you are going to DDD North and would like to see my talk, do go and vote for it. (It is called "Listen Up - An Introduction to the System.Speech namespace").
If it gets voted for, i'll actually have to put the talk together..
And make sure you look out for System-Speech.com. No doubt i'll post again once it is up and running.
.new SpeechSynthesizer().Speak("Thanks!");
-- Lee