Skip to content
Text to Speech Plugin for Xamarin and Windows
C#
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
art Point to correct sln and add appveyor yml Jun 3, 2016
samples Update sample Jul 11, 2017
src Create speechsynth each time to avoid issues when there is a audio ro… May 30, 2018
.editorconfig Update to .NET Standard Library Jun 21, 2017
.gitignore Initial commit Jun 2, 2016
CHANGELOG.md Additional updates for #45 to adjust volume Feb 3, 2018
LICENSE
README.md Update README.md Jun 29, 2019

README.md

Text To Speech Plugin for Xamarin and Windows

Simple and elegant way of performing Text To Speech across Xamarin.iOS, Xamarin.tvOS, Xamarin.macOS Xamarin.Android, Windows, and Xamarin.Forms projects.

Preview: http://screencast.com/t/voW1P48Ka

Setup

Build status:

The Future: Xamarin.Essentials

I have been working on Plugins for Xamarin for a long time now. Through the years I have always wanted to create a single, optimized, and official package from the Xamarin team at Microsoft that could easily be consumed by any application. The time is now with Xamarin.Essentials, which offers over 50 cross-platform native APIs in a single optimized package. I worked on this new library with an amazing team of developers and I highly highly highly recommend you check it out.

I will continue to work and maintain my Plugins, but I do recommend you checkout Xamarin.Essentials to see if it is a great fit your app as it has been for all of mine!

Platform Support

Platform Version
Xamarin.iOS iOS 7+
Xamarin.Android API 10+
Windows 10 UWP 10+
Xamarin.Mac All
Xamarin tvOS All

Features

  • Speak back text
  • Pitch
  • Volume
  • Speak Rate
  • Locale/Language of Speech
  • Gather all available languages to speak in

Usage

Simple Text

await CrossTextToSpeech.Current.Speak("Text to speak");

Advanced speech API

/// <summary>
/// Speack back text
/// </summary>
/// <param name="text">Text to speak</param>
/// <param name="crossLocale">Locale of voice</param>
/// <param name="pitch">Pitch of voice (All 0.0 - 2.0f)</param>
/// <param name="speakRate">Speak Rate of voice (All) (0.0 - 2.0f)</param>
/// <param name="volume">Volume of voice (0.0-1.0)</param>
/// <param name="cancelToken">Cancel the current speech</param>
public async Task Speak(string text, CrossLocale crossLocale = null, float? pitch = null, float? speakRate = null, float? volume = null, CancellationToken cancelToken = default(CancellationToken))

CrossLocale I developed the CrossLocale struct mostly to support Android, but is nice because I added a Display Name.

You can query a list of current support CrossLocales on the device:

/// <summary>
/// Get all installed and valide lanaguages
/// </summary>
/// <returns>List of CrossLocales</returns>
public Task<IEnumerable<CrossLocale>> GetInstalledLanguages()

Each local has the Language and Display Name. The Country code is only used in Android. If you pass in null to Speak it will use the default.

Implementation

  • iOS: AVSpeechSynthesizer
  • Android: Android.Speech.Tts.TextToSpeech
  • Windows: SpeechSynthesizer + Ssml support for advanced playback

Windows Phone You must add ID_CAP_SPEECH_RECOGNITION permission

Branches

Main branch is always the current development beta branch. This means that all new work can be done off this branch. For each release of a stable NuGet package a new release branch will be created so any additional hot fixes could be done off of that branch.

License

Under MIT, see LICENSE file.

You can’t perform that action at this time.