Neural-Space / speakns

NPM library to enable voice based typing on input/textarea elements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo

Speakns

Speakns ( pronounced "Speak NS" ) is a Javascript library that enables Voice typing on any input/textarea element by using Neural Space Speech-To-Text Streaming API.

Pre-requisites

You need a NeuralSpace platform auth code to be able to initialize the library.

Sign up is free and you get free credits too.

Sign in to the NeuralSpace platform

You can copy the auth code on the top right corner of the platform

Features

  • Enable Voice typing on Input/Textarea elements
  • Callback events for onRecordingStart and onRecordingStop events
  • Configurable maximum speaking duration
  • Cross browser compatibility

Installation

Install speakns

With npm

  npm install speakns --save

Usage

import VoiceType from "speakns";

let voiceType = new VoiceType({
    authToken: "<YOUR_NEURALSPACE_AUTH_TOKEN>",
    language: "en", // Your speaker's language
    domain: "general", // Refer documentation for available domains
    elementId: "mytext", // Id of the input/textarea element on which you want to initialize voice typing
    onRecordingStart : function recordingStarted(){
        // Callback fired once the recording starts
    },
    onRecordingStop : function recordingStopped(){
        // Callback fired once the recording stops
    },
    maxSpeakingDuration: 10 // (In seconds) Automatically stop recording after configuring the interval here
  });

Use the voiceType object apis to start and stop recording

To Start recording

voiceType.startRecording()

To Stop recording

voiceType.stopRecording()

About

NPM library to enable voice based typing on input/textarea elements


Languages

Language:JavaScript 100.0%