You may have noticed that I am on a big Plugins for Xamarin kick currently. I have always had my Settings Plugin that I have updated over time, but then I blogged about creating plugins for Xamarin.Forms, released a Vibrate Plugin, and then discussed exactly what a Plugin for Xamarin is. I love plugins as they can abstract away features common on platforms into a simple API so you never have to write the same code twice. Today, I am please to announce and release my latest plugin, text to speech.
I have seen Nick Landry’s session on implementing Text to Speech with Cortana and how you can add this small feature to your applications to add some really unique functionality. The issue of course is that each platform handles Text to Speech completely different. I have create a very simple yet flexible API allowing you to add Text to Speech functionality to: Xamarin.iOS, Xamarin.Android, Windows Phone, and Windows Store.
GetInstalledLanguagesThis was bonus perk really to add, which was the ability to gather all of the installed languages that are compatible with the Text To Speech engine on the platform. This allows you to manually set or allow your user to pick what language they want to speak back with. On Android this even takes advantage of the new Lollipop APIs!
SpeakMy speak API allows you to simply pass in some text to speak back with all defaults, or really go to down and completely customize how the TTS engine plays back the sound. Here is what it looks like:
As you can see you have complete control over pitch, speak rate, locale, and even if you want to queue up the TTS engine or stop it completely. I am really proud to say that on Windows Phone/Store I use the complete Ssml engine to handle the advanced functionality, which is pretty slick.
Get It Today
The full source code is available today on GitHub along with full API documentation. Of course you can grab the NuGet as well and install it from Xamarin Studio or Visual Studio in a Xamarin or Xamarin.Forms project.