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

sonuslab

v0.1.2

Published

Official SonusLab SDK for audio clipping, text-to-speech, and voice cloning

Readme

sonuslab

Official SonusLab SDK for audio clipping, text-to-speech, and voice cloning.

Install

npm install sonuslab
# or
pnpm add sonuslab
# or
bun add sonuslab

Requires Node.js 18+.

Quickstart

import { SonusLab } from "sonuslab";

const sonus = new SonusLab(process.env.SONUSLAB_API_KEY!);
// or with custom base URL:
// const sonus = new SonusLab({ apiKey: "...", baseUrl: "https://api.sonuslab.dev" });

Every call returns a discriminated Result. Narrow by checking error first — when error is non-null, the named data key is null, and vice versa.

const { clips, error } = await sonus.clips.list();
if (error) throw error;
console.log(clips.items);

Clips

Create and manage audio clips extracted from source media (e.g. YouTube URLs).

// Inspect a source URL before clipping
const { metadata, error } = await sonus.clips.getMetadata({
  url: "https://www.youtube.com/watch?v=...",
});

// Create a clip
const { clip } = await sonus.clips.create({
  url: "https://www.youtube.com/watch?v=...",
  start: 12.5,
  end: 24.0,
  name: "intro-hook",
});

// List, get, delete
const { clips } = await sonus.clips.list({ limit: 20 });
const { clip: one } = await sonus.clips.get("clip_123");
const { ok } = await sonus.clips.delete("clip_123");

Text-to-Speech

Generate speech with ElevenLabs or Fish providers.

const { sound, error } = await sonus.tts.generate({
  provider: "elevenlabs",
  voiceId: "voice_abc",
  text: "Hello from SonusLab.",
  modelId: "eleven_multilingual_v2",
  stability: 0.5,
  similarityBoost: 0.75,
});

// List available ElevenLabs voices
const { voices } = await sonus.tts.listVoices();

Voice Cloning

Clone a voice from an audio sample URL.

// Step 1: prepare and preview a sample
const { sample } = await sonus.voices.prepareSample({
  url: "https://example.com/sample.mp3",
});

// Step 2: create the voice clone
const { voice } = await sonus.voices.create({
  name: "my-voice",
  audio: sample!.audio,
  format: sample!.format,
  sampleRate: sample!.sampleRate,
});

// Manage clones
const { voices } = await sonus.voices.list();
const { ok } = await sonus.voices.delete("voice_123");

Error Handling

Failed requests resolve with error: SonusLabError — the promise does not reject.

import { SonusLabError } from "sonuslab";

const { clip, error } = await sonus.clips.get("missing");
if (error) {
  // error.status, error.body, error.message
  if (error.status === 404) {
    // handle not found
  }
  throw error;
}

Transient failures (408, 429, 5xx) retry automatically up to 2 times.

Cancellation

All methods accept an AbortSignal via the second argument:

const ac = new AbortController();
const promise = sonus.clips.list(undefined, { signal: ac.signal });
ac.abort();

License

MIT