Skip to content

A Zebble plugin for using Text to Speech and Speech recognition in apps

Notifications You must be signed in to change notification settings

Geeksltd/Zebble.Speech

Repository files navigation

Zebble.Speech

logo

A Zebble plugin To get the device operating system to read a piece of text out loud or recongnize the spoken words.

NuGet

With the user's permission, get recognition of live and prerecorded speech, and receive transcriptions. Also you'll be able to convert text to spoken language.


Setup


Platform Specific Notes

iOS

In order to be able to use the speech recognition, you need to add the following tags to the info.plist file.

<key>NSMicrophoneUsageDescription</key>
<string>{A proper description.}</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>{A proper description.}</string>

Api Usage

Call Zebble.Device.Speech from any project to gain access to APIs.

Read a text:
await Device.Speech.Speak("Hello world!");
Stop reading:
Device.Speech.Stop();
Get available languages:
var languages = Device.Speech.Language.GetInstalledLanguages();
Text to Speech Settings:
var settings = new Device.Speech.Settings
{
    // The relative highness or lowness of a tone as perceived by the ear
    // Default pitch is 1
    Pitch = 1.2, 
    // Default speed is 1
    // It could be a value between 0 to 10
    Speed = 1.5,
    // Default volume is 1
    // It could be a value between 0 to 1
    Volume = 0.8,
    // If not specified, the device's default language will be used
    Language = new Device.Speech.Language("fr")
};

await Device.Speech.Speak("Hello world!", settings);
To use speech recognizer:
void StartButtonTapped()
{
   Device.Speech.Recognizer.Start(Listener);
}

void Listener(string heardWords)
{
   // TODO: Use the words as you please. 
   // The provided string may contain a single word; or a number of them.
   // For example, you can use a class-level StringBuilder class, 
   // add all heard words to it, and show the concatenated result on the screen.
}

void StopButtonTapped()
{
   Device.Speech.Recognizer.Stop();
}

Methods

Method Return Type Parameters Android iOS Windows
Speech.Speak Task text -> string
setting -> Speech.Settings
x x x
Speech.Stop void - x x x
Speech.Recognizer.Start Task<bool> listener -> Action<string> errorAction -> OnError x x x
Speech.Recognizer.Stop Task - x x x

About

A Zebble plugin for using Text to Speech and Speech recognition in apps

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages