Using Text to Speech API for your apps

Speech technology has come of age. If you have a smartphone or tablet, perform various tasks on victimizing the voice device. For example, you can send a text message, update the calendar, set an alarm, and do many alternate things with a single spoken command that can take various measures to complete the victimization of older forms such as sound and choice using text to speech api.

For those who wish to develop their own voice-based applications, Ispeech provides APIs for basic speech recognition (TTS) and automatic speech recognition (ASR) technologies. Using these developers APIs produce useful interactive voice applications. This article provides an overview of Ispeech APIs and then goes on to indicate some examples of voice-based applications designed around Apis.

Using API synthesis text to speech Ispeech

TTS is available in humanoid devices from one.6 (API Level 4). TTS boot engine involves the instance of the associated Text To Speech api grade category with the tactics that will be killed when the TTS engine is initialized. To prove that TTS is initialized is performed through an interface known as OnInitListener. If TTS initialization is complete, the onInit method is invoked.

If TTS is initialized correctly, the method is invoked to speak to express some words:

TextToSpeech tts = new TextToSpeech (this,

New OnInitListener ()

}

Because of limited storage on some devices, not all supported languages ​can actually be placed on a specific device so it is necessary to examine whether a specific language is accessible before making the TextToSpeech object. That way, you can transfer files and install features specific to the language you want, if necessary. This is done by sending the Intention degree associated with the ACTION_CHECK_TTS_DATA action, which is part of the TextToSpeech.Engine class:

Intent = new Intent in store (TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);

StartActivityForResult (TTS_DATA_CHECK attempt);

If the data in the language is installed correctly, the driver will receive a CHECK_VOICE_DATA_PASS onActivityResult. If the data is not available, the action will be executed ACTION_INSTALL_TTS_DATA:

InstallData intent = new Intent (Motor ACTION_INSTALL_TTS_DATA.);

StartActivity (installData);

Development of voice applications for Android

A possible use case for this type of application is when the user accesses any text on the Web, for example, news, email or a sports report. This is useful if the eyes and hands of the user are busy or if there are reading problems text on the screen. In this example, the application retrieves some text and the user presses the Speak button to listen. A stop button, if the user does not want to hear all the text is provided.

Using Ispeech Voice Recognition API

There are two ways in which voice recognition is often distributed on the associated automaton device: based primarily on RecognizerIntent, or the creation of an associated SpeechRecognizer instance.

The following code demonstrates a way to begin the associated activity of recognizing the primary exploit speech approach:

Intention intention = new

Intent (RecognizerIntent.ACTION_RECOGNIZE_SPEECH);

// Specify the language model

Intent.putExtra (RecognizerIntent.EXTRA_LANGUAGE_MODEL,

LanguageModel);

// Specifies the number of results to receive.

Intent.putExtra (RecognizerIntent.EXTRA_MAX_RESULTS,

NumberRecoResults);

// Start listening

StartActivityForResult (intent, ASR_CODE);

The application shown below illustrates the following:

  • The user selects the parameters for voice recognition.
  • The user presses a button and says a few words.
  • Recognized words are displayed in a list next to your trusted score.

Development of voice applications for Android

Multilingual applications

It is important to develop applications in languages other than English. TTS and ASR engines can be designed for a good variety of languages. However, we can not expect that all languages ​​are accessible or are supported on a selected device. Therefore, before choosing a display language it is necessary whether one of the languages ​​supported, and if not, to establish the most popular language.

To try to do so, a sorted RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS release that returns a package from which you can extract the data relative to the popular language (RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE) and the list of supported languages ​​(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES) is sent. For speech recognition, a new parameter for the intent within which the language to be used for recognition, as shown in the following line of code is specified is entered:

Intent.putExtra (RecognizerIntent.EXTRA_LANGUAGE, language);

As shown in the figure, the user is prompted for a language and application recognizes what the user says and plays the easiest recognition end in the chosen language.

Development of voice applications for Android

Creating a Virtual Personal Assistant (VPA)

Many voice-based applications need to do more than just speak and understand speech. For example, a VPA also requires the ability to maintain a dialog with the user and perform operations, such as connecting to web services and activating device functions.

The following figure shows two VPAs, Jack and Derek, which were developed this way.

Development of voice applications for Android

Jack is a commonly used VPA while Derek VPA is a specialist who can answer questions about type 2 diabetes such as symptoms, causes, treatment, risks to children and complications.

Summary

The Ispeech Voice API can be used in numerous ways to develop interesting and useful voice-based applications. This article shows you some examples. Based on these you can bring the power of voice to your Android applications, making them more elegant and intuitive, and enhance the mobile user experience.


About