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

@responsivevoice/core

v2.0.1

Published

Modern, TypeScript-first text-to-speech (TTS) for the browser — native voices with automatic server fallback, streaming, and premium voices (Azure, OpenAI, Google Cloud, and more).

Readme


Installation

# npm
npm install @responsivevoice/core

# yarn
yarn add @responsivevoice/core

# pnpm
pnpm add @responsivevoice/core

Get your API credentials

Out of the box, core runs in demo mode — it speaks with the browser's default voice only. Registering and verifying your website unlocks the full server voice catalog:

  1. Register for a free ResponsiveVoice account.
  2. A default website is created for you automatically — its identifier is your API key. Copy it from the dashboard.
  3. Initialize core with your API key.
  4. Verify your website's domain in the dashboard so requests from your site are recognized — this unlocks the full set of voices.

Quick Start

ES Module

import { getResponsiveVoice } from '@responsivevoice/core';

const rv = await getResponsiveVoice({ apiKey: 'YOUR_API_KEY' });

// Basic usage
rv.speak('Hello world', 'UK English Female');

// With options
rv.speak('Hello world', 'UK English Female', {
  pitch: 1.0,
  rate: 1.0,
  volume: 1.0,
  onstart: () => console.log('Started'),
  onend: () => console.log('Finished'),
});

Browser bundle (CDN)

<script src="https://cdn.responsivevoice.org/sdk/latest/responsivevoice.js"></script>
<script>
  responsiveVoice.init({ apiKey: 'YOUR_API_KEY' });
  responsiveVoice.speak('Hello world', 'UK English Female');
</script>

API

Initialization

// Recommended: async factory (creates singleton, calls init internally)
const rv = await getResponsiveVoice({ apiKey: 'YOUR_KEY' });

// Alternative: manual construction + init
const rv = new ResponsiveVoice();
await rv.init({ apiKey: 'YOUR_KEY' });

| Option | Type | Default | Description | | ---------------- | --------- | --------------------- | ----------------------------------------- | | apiKey | string | — | Your registered website/origin identifier | | defaultVoice | string | 'UK English Female' | Default voice name | | forceFallback | boolean | false | Force HTTP audio (skip native TTS) | | characterLimit | number | 100 | Text chunk character limit | | transport | string | 'chunks' | Audio transport: chunks/stream/websocket |

Methods

speak(text, voice?, options?)

Speaks the given text.

rv.speak('Hello world');
rv.speak('Hello world', 'US English Male');
rv.speak('Hello world', 'UK English Female', {
  rate: 1.2,
  onend: () => console.log('Done'),
});

cancel()

Stops all speech.

rv.cancel();

pause()

Pauses current speech.

rv.pause();

resume()

Resumes paused speech.

rv.resume();

getVoices()

Returns available voices.

const voices = rv.getVoices();
// [{ name: 'UK English Female', lang: 'en-GB', gender: 'f' }, ...]

isPlaying()

Returns whether speech is currently playing.

if (rv.isPlaying()) {
  rv.cancel();
}

Events

rv.speak('Hello', 'UK English Female', {
  onstart: () => console.log('Started'),
  onend: () => console.log('Finished'),
  onerror: (error) => console.error('Error:', error),
});

Browser Support

For detailed compatibility information, see the Browser Support documentation.

Minimum browser versions:

| Browser | Min Version | Native TTS | Fallback API | | -------------- | ----------- | ---------- | ------------ | | Chrome | 66+ | Yes | Yes | | Firefox | 57+ | Limited | Yes | | Safari | 14+ | Yes | Yes | | Edge | 16+ | Yes | Yes | | iOS Safari | 14+ | Yes | Yes | | Chrome Android | 66+ | Yes | Yes |

Bundlers

Core targets the browser. Install it from npm and bundle it with Vite, webpack, or any modern bundler — it runs in the browser, not server-side. For server-side or headless TTS (HTTP synthesis without a browser), use @responsivevoice/api-client directly.

Migration from Legacy

Script Tag (most legacy users)

<!-- Before -->
<script src="https://code.responsivevoice.org/responsivevoice.js?key=YOUR_KEY"></script>
<script>
  responsiveVoice.speak('Hello');
</script>

<!-- After — only change: remove ?key from URL, add init() call -->
<script src="https://cdn.responsivevoice.org/sdk/latest/responsivevoice.js"></script>
<script>
  responsiveVoice.init({ apiKey: 'YOUR_KEY' });
  responsiveVoice.speak('Hello');
</script>

See the Migration Guide for details.

Documentation

Full documentation at docs.responsivevoice.org.

License

MIT


Other language SDKs: Python · Go · PHP · Java