npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-speech

v0.0.4

Published

This is cordova plugin for Speech Recognition and Text to Speech.

Downloads

51

Readme

cordova-plugin-speech

npm Platform

This is cordova plugin for Speech Recognition and Text to Speech.

Installation

cordova plugin add cordova-plugin-speech

Supported Platforms

  • Android
  • iOS

Usage

This plugin works with internet connection and without internet if language package available on device.

supportedLanguages

Speech.supportedLanguages

[]String - Returns list of supported Speech to Text language models.

getSupportedVoices()

Speech.getSupportedVoices(Function successCallback, Function errorCallback)

Result of success callback is an Array of supported voices.

defaultLanguage

Speech.supportedLanguages

String - Returns systems default Speech to Text language model.

speakOut()


let options = {
  Number pitchRate,
  Number speechRate,
  String language
}

Speech.speakOut(String message, Function successCallback, Function errorCallback, Object options)

message - {String} message for speaking.

Result of success callback is an String of TTS states as below:

  • tts-start States that TTS started.
  • tts-end States that TTS ended.

This method has an options parameter with the following optional values:

  • pitchRate {Number} used for TTS pitch rate.
  1. iOS - The default pitch is 1.0. Allowed values are in the range from 0.5 (for lower pitch) to 2.0 (for higher pitch).
  2. Android - The default pitch is 1.0, lower values lower the tone of the synthesized voice, greater values increase it.
  • speechRate {Number} used for TTS speech rate.
  1. iOS - The default speech rate is 0.5. Lower values correspond to slower speech, and vice versa.
  2. Android - The default speech rate is 1.0. Lower values correspond to slower speech, and vice versa.
  • language {String} used for TTS speech voice.
  1. iOS - Use Speech.getSupportedVoices() to get voices and use selectedVoice.language as input.
  2. Android - Use Speech.getSupportedVoices() to get voices and use selectedVoice.name as input.

initRecognition()


let options = {
  String language
}

Speech.initRecognition(
  Function successCallback, Function errorCallback, Object options)

Result of success callback is an Object of recognition features as below:

  • offlineRecognitionAvailable {Boolean} states that offline speech recognition is available or not. For Android it's values is always true.

This method has an options parameter with the following optional values:

  • language {String} used language for recognition (default is systems default lanuguage model).

startRecognition()


let options = {
  Boolean partialResultRequired,
  Boolean offlineRecognitionRequired
}

Speech.startRecognition(
  Function successCallback, Function errorCallback, Object options)

Result of success callback is an Object of recognized terms:

  • isFinal {Boolean} In case of partial result it is false otherwise it's true.
  • text {String} Recognized text.

This method has an options parameter with the following optional values:

  • partialResultRequired {Boolean} Allow partial results to be returned (default false)
  • offlineRecognitionRequired {Boolean} Enables offline speech recognition if language model available (default false)

There is a difference between Android and iOS platforms. On Android speech recognition stops when the speaker finishes speaking (at end of sentence). On iOS the user has to stop manually the recognition process by calling stopRecognition() method.

stopRecognition()

Speech.stopRecognition(
  Function successCallback, Function errorCallback)

Stop the recognition process. Returns true.

Android Quirks

Requirements

  • cordova-android v5.0.0
  • Android API level 14
  • RECORD_AUDIO permission

Further readings

  • https://developer.android.com/reference/android/speech/package-summary.html
  • https://developer.android.com/reference/android/speech/SpeechRecognizer.html

iOS Quirks

Requirements

Further readings

  • https://developer.apple.com/reference/speech?language=swift
  • https://developer.apple.com/reference/speech/sfspeechrecognizer?language=swift

Author

Pravinkumar Putta

  • https://github.com/pravinkumarputta

LICENSE

cordova-plugin-speech is licensed under the MIT Open Source license. For more information, see the LICENSE file in this repository.