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

@kirillasyamov/text-to-speech

v1.5.1

Published

Autonomous Edge TTS library with streaming synthesis and local playback

Readme

Install

npm install

Library

Autonomous Edge TTS library - pooled ws connections, streaming audio, no server required.

npm install @kirillasyamov/text-to-speech
import { createWriteStream } from "node:fs";
import { pipeline } from "node:stream/promises";
import { Readable } from "node:stream";
import TextToSpeech from "@kirillasyamov/text-to-speech";

const tts = new TextToSpeech({
  voice: "ru-RU-SvetlanaNeural",
  speed: 1.2,
  warm: true,
});

for await (const chunk of tts.stream("Hello world")) {
  process.stdout.write(chunk);
}

// await pipeline(Readable.from(stream), createWriteStream('out.mp3'));
// const audio = await tts.speak("Save me to a buffer as MP3.");
// const small = await tts.speak("Smaller stream.", { format: "webm-24khz-16bit-mono-opus" });
await tts.play("Play me through ffplay.");
const voices = await tts.voices({ language: "ru-RU" });

Default export and named export TextToSpeech are the same class. The package also exports play, listVoices, close, TtsError and PlayerError.

Audio is streamed in chunks as it is synthesized, so playback can start before the whole text is ready. The format option (constructor, setDefaults, or per call) accepts audio-24khz-48kbitrate-mono-mp3 (default), audio-24khz-96kbitrate-mono-mp3 or webm-24khz-16bit-mono-opus. The server, CLI and UI also accept the short aliases mp3, mp3-96 and opus (also webm).

Server

npm run ui
make ui

OpenAI-compatible endpoint POST /v1/audio/speech takes input, voice, speed and response_format (mp3, mp3-96, opus/webm, or a raw engine id); response Content-Type follows the format (audio/mpeg / audio/webm). GET /v1/models and GET /v1/voices list models and voices.

CLI

node src/index.js "Hello world"
node src/index.js "Hello world" --format opus --out out.webm
make ARGS="Hello world"

Web UI

http://localhost:5051

Publishing

Local publish (token is read from .env):

make publish
make publish-patch
make publish-minor
make publish-major

Limitations

  • The Microsoft Edge TTS endpoint is unofficial and has no SLA, so heavy or sustained use can trigger throttling or 403 rejections that the library cannot recover from.
  • The server enforces no rate limiting, concurrency cap, or API key, so anyone who reaches the port can send unlimited requests.
  • The full request body is buffered in memory with no upper bound, and long text is synthesized sequentially in 4000-byte turns.
  • Only three output formats are supported (mp3, mp3-96, opus/webm); any other response_format returns 400. No transcoding is performed.
  • /v1/voices returns only DEFAULT_LANGUAGE voices unless you pass ?language=all.
  • The connection pool lives only in memory and is lost on restart, with warm connections expiring after about 120 seconds of inactivity.
  • If synthesis fails mid-stream, the already-sent headers cannot be changed, so the client receives a silently truncated audio stream.

License

MIT