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 🙏

© 2026 – Pkg Stats / Ryan Hefner

speak-ez

v1.0.3

Published

Browser Text-to-Speech (TTS using WebSpeech API) made easy

Downloads

54

Readme

SpeakEZ

SpeakEZ is a lightweight TypeScript library that simplifies the use of the Web Speech API for text-to-speech functionality in web applications. It provides an easy-to-use interface for configuring speech parameters, selecting voices, and handling speech synthesis with improved sentence splitting for better results.

Features

  • Simple and intuitive API for text-to-speech synthesis.
  • Configurable speech parameters: volume, rate, pitch, and voice selection.
  • Automatic sentence splitting for improved speech quality.
  • Promise-based interface for easy integration with modern JavaScript/TypeScript applications.

Installation

You can install SpeakEZ via npm:

npm install speak-ez

Usage

Here's a basic example of how to use SpeakEZ in your project:

import SpeakEZ from 'speak-ez';

const speakWords = async (text: string) => {
	// Create an instance of SpeakEZ
	const ez = new SpeakEZ();

	// Check for browser support
	if (!ez.isSupportedBrowser) {
		console.error('Speech Synthesis is not supported in this browser.');
		return;
	}

	// Speak the provided text
	ez.speak(text);
};

speakWords('Hello world!');

API

new SpeakEZ()

Creates a new instance of SpeakEZ with optional configuration.

init(config?)

Initializes the SpeakEZ instance with the provided configuration and fetches available voices. This is not strictly necessary unless you want to set a custom voice. Individual properties can be set directly on the instance.

config Object Properties

  • lang: Language code for selecting the default voice (e.g., 'en-US').
  • volume: Volume level (0.0 to 1.0).
  • rate: Speech rate (0.1 to 10).
  • pitch: Speech pitch (0.0 to 2.0).
  • voice: Selected voice for speech synthesis (string or SpeechSynthesisVoice).
  • shouldSplitSentences: Boolean indicating whether to split text into sentences for better speech synthesis
  • voiceLoadTimeoutInMilliseconds: Timeout in milliseconds to wait for voices to load (default: 1000).

speak(text, options?)

Speaks the provided text with optional event listeners.

text

The text to be spoken.

options Object Properties

  • listeners: An object containing event listeners for speech synthesis events (start, end, error, pause, resume, mark, boundary).
  • interrupt: Boolean indicating whether to interrupt ongoing speech (default: false).

pause()

Pauses the current speech synthesis.

resume()

Resumes the paused speech synthesis.

cancel()

Cancels the current speech synthesis.

Properties

  • isSupportedBrowser: Boolean indicating if the browser supports Speech Synthesis.
  • voices: Array of available speech synthesis voices.
  • volume: Volume level (0.0 to 1.0).
  • rate: Speech rate (0.1 to 10).
  • pitch: Speech pitch (0.0 to 2.0).
  • shouldSplitSentences: Boolean indicating whether to split text into sentences for better speech synthesis
  • voice: Selected voice for speech synthesis.
  • speaking: Boolean indicating if speech synthesis is currently in progress.
  • pending: Boolean indicating if speech synthesis is pending.
  • paused: Boolean indicating if speech synthesis is paused.

License

SpeakEZ is licensed under the MIT License. See the LICENSE file for more information.