@lephenix47/speech-to-text-utility
v1.0.1
Published
description
Downloads
2
Readme
@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
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!