New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vocalfusion.io

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vocalfusion.io

A lightweight Text-to-Speech library.

  • 1.1.12
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-58.82%
Maintainers
0
Weekly downloads
 
Created
Source

VocalFusion.io

A comprehensive library suite leveraging Web APIs for Text-to-Speech (TTS) and Speech-To-Text (STT) functionalities. Easily integrate voice synthesis and speech recognition into your web projects with options for customization and seamless browser compatibility.


Installation

Install the package via npm:

npm install vocalfusion.io

Features

FeatureDescriptionStatus
CustomizableAdjust the rate, pitch, and voice of speech synthesis (TTS).✅ Complete
Promise-BasedIntuitive API design with success and error handling via Promises.✅ Complete
Browser-FriendlyDesigned to work seamlessly with modern web browsers.✅ Complete
LightweightNo external dependencies, uses native Web APIs (TTS & STT).✅ Complete
Error HandlingProvides detailed error messages for invalid or missing inputs.✅ Complete

Usage

Importing the Library

ES Module
import { TTS, STT } from "./node_modules/vocalfusion.io/dist/index.esm.js";

// TTS Example
TTS.speak("Hello, World!")
  .then(() => console.log("Speech completed"))
  .catch(console.error);

// STT Example
const speech = new STT({ lang: "en-US", continuous: true });
speech.start();
speech.onResult((transcript) => {
  console.log("Recognized speech:", transcript);
});
speech.onError((err) => console.error("Error:", err));
CommonJS
const { TTS, STT } = require("./node_modules/vocalfusion.io/dist/index.cjs.js");

// TTS Example
TTS.speak("Hello, World!")
  .then(() => console.log("Speech completed"))
  .catch(console.error);

// STT Example
const speech = new STT({ lang: "en-US", continuous: true });
speech.start();
speech.onResult((transcript) => {
  console.log("Recognized speech:", transcript);
});
speech.onError((err) => console.error("Error:", err));

TTS Options

ParameterTypeDefaultDescription
textstringnullThe text to be spoken.
ratenumber1The speech rate (range: 0.1 to 10).
pitchnumber1The pitch of the voice (range: 0 to 2).
voicestringnullThe name of the voice to use (optional).

STT Options

ParameterTypeDefaultDescription
langstringen-USThe language for speech recognition.
interimResultsbooleantrueEnable or disable interim results during recognition.
continuousbooleanfalseSet whether recognition continues after each phrase.

Examples

TTS Examples

Speak Text with Default Settings
TTS.speak("Hello, how are you?")
  .then(() => console.log("Speech completed"))
  .catch(console.error);
Speak Text with Custom Settings
TTS.speak("Custom settings example.", {
  rate: 1.5,
  pitch: 2,
  voice: "Google UK English Male"
})
  .then(() => console.log("Speech completed"))
  .catch(console.error);
Retrieve Available Voices
TTS.getVoices()
  .then((voices) => console.log("Available voices:", voices))
  .catch(console.error);

STT Examples

Start Speech Recognition
const speech = new STT({ lang: "en-US", continuous: true });
speech.start();
speech.onResult((transcript) => {
  console.log("Recognized speech:", transcript);
});
speech.onError((err) => console.error("Error:", err));
Restart on Recognition End
speech.onEnd(() => {
  console.log("Recognition ended. Restarting...");
  speech.start();
});
Stop Speech Recognition
speech.stop();
speech.onEnd(() => {
  console.log("Speech recognition stopped.");
});

Browser Compatibility

BrowserSupportedNotes
Chrome✅ YesFull support.
Firefox✅ YesFull support.
Safari✅ YesFull support (macOS/iOS).
Edge✅ YesFull support.
Internet Explorer❌ NoNot supported.

For more details, visit Can I Use - SpeechSynthesis and Can I Use - SpeechRecognition.


Contributing

We welcome contributions! To contribute:

For questions or suggestions, feel free to email us at ytraj0660@gmail.com.


License

This project is licensed under the MIT License. See the LICENSE file for details.

Keywords

FAQs

Package last updated on 14 Dec 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