Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lephenix47/speech-to-text-utility

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lephenix47/speech-to-text-utility

description

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@lephenix47/speech-to-text-utility

Table of Contents

Introduction

Introducing the @lephenix47/speech-to-text-utility library, a powerful and flexible solution designed for JavaScript and TypeScript developers looking to integrate speech recognition features into their projects. Built with simplicity and extensibility in mind, this library harnesses the power of the browser's Web Speech API to transcribe real-time audio inputs with ease.

Usage

Importing the Library

To begin, you'll need to import the library into your project:

  import { SpeechToText } from '@lephenix47/speech-to-text-utility';

Configuring and Starting Speech Recognition

From here, you can personalize the speech recognition behavior to fit your application's demands. Some notable methods worth mentioning include setting the language, enabling interim results, limiting the number of alternatives, toggling continual recognition, and configuring event callbacks.

Example:

  const speechToText = new SpeechToText();

  speechToText
    .setLanguage('en-US')
    .setInterimResults(true)
    .setMaxAlternatives(5)
    .setContinuous(true)
    .setOnResult((sentence, isFinal) => {
      if (isFinal) {
        console.log(`Received Final Result: "${sentence}"`);
      } else {
        console.log(`Received Intermediate Result: "${sentence}"`);
      }
    });

Ready to embark on recognizing speech? Trigger the speech recognition engine with the startRecognition() method.

  speechToText.startRecognition();

Should you ever decide to halt the recognition midway, rely on the handy stopRecognition() method.

  speechToText.stopRecognition();

Available Methods and Properties

📖 Table of all the methods and properties
MethodDescriptionReturn Value
setLanguage(language: string)Sets the language for the speech recognition.SpeechToText
setInterimResults(bool: bool)Determines if interim results are included in the recognition.SpeechToText
setMaxAlternatives(num: number)Limits the number of recognition alternatives offered.SpeechToText
setContinuous(bool: bool)Switches on or off the continuous speech recognition mode.SpeechToText
setOnResult(fn: Function)Registers a callback function invoked whenever a speech recognition result occurs.SpeechToText
setOnEnd(fn: Function)Subscribes to the speech recognition ending event.SpeechToText
setOnError(fn: Function)Signs up for the speech recognition error event.SpeechToText
setOnStart(fn: Function)Hooks into the speech recognition initialization event.SpeechToText
setOnAudioStart(fn: Function)Captures the audio capturing commencement event.SpeechToText
setOnSoundStart(fn: Function)Monitors the audio's sonic occurrences triggering the fn callback.SpeechToText
setOnSoundEnd(fn: Function)Observes the conclusion of auditory happenings invoking the fn callback.SpeechToText
setOnSpeechStart(fn: Function)Seizes the moment when vocalizations ignite the fn callback.SpeechToText
setOnSpeechEnd(fn: Function)Records the culmination of verbal articulations summoning the fn callback.SpeechToText
setOnNoMatch(fn: Function)Documents the absence of a match incited by the fn callback.SpeechToText
startRecognition()Commences speech recognition processing.Promise<void>
stopRecognition()Terminates ongoing speech recognition activity.Promise<void>
get maxAlternatives()Retrieves the maximum number of recognition alternatives.number
get continuous()Obtains the status of continuous speech recognition.boolean

Conclusion

Integrating speech recognition into your projects has never been simpler, courtesy of the @lephenix47/speech-to-text-utility library. Benefit from hassle-free integration, robustness, and extensive customizability today! Should you require any assistance or contribute, head over to GitHub and join the community.

Don't hesitate to leave a star rating or review to express appreciation for this open-source endeavor. Happy coding!

FAQs

Package last updated on 23 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc