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

@charivo/stt-transcriber-web

v0.0.1

Published

Web Speech API STT transcriber for Charivo

Readme

@charivo/stt-transcriber-web

Web Speech API-based STT transcriber for Charivo (browser-native, free).

Overview

Uses the browser's built-in speech recognition to convert speech to text without requiring any API keys. Perfect for quick prototyping and production applications that need real-time voice input.

Features

  • 🎤 Browser-Native Recognition - Uses Web Speech API
  • 💰 Free - No API key required
  • Real-Time Recognition - Instant speech-to-text conversion
  • 🌐 Multi-Language - Supports languages available in the browser
  • 🔒 Privacy-Friendly - Processed in browser (browser-dependent)

Installation

pnpm add @charivo/stt-transcriber-web

Usage

Basic Setup (with STTManager)

import { createWebSTTTranscriber } from "@charivo/stt-transcriber-web";
import { createSTTManager } from "@charivo/stt-core";

const transcriber = createWebSTTTranscriber();
const sttManager = createSTTManager(transcriber);

// Check browser support
if (!transcriber.isSupportedBrowser()) {
  console.error("This browser doesn't support Web Speech API");
}

// Start speech recognition
await sttManager.start({ language: "en-US" });

// Stop and get transcription
const transcription = await sttManager.stop();
console.log("User said:", transcription);

Korean Speech Recognition

await sttManager.start({ language: "ko-KR" });
const text = await sttManager.stop();
console.log("Korean result:", text);

Direct Usage (without STTManager)

// Start recording
await transcriber.startRecording({ language: "en-US" });

// Stop and get result
const text = await transcriber.stopRecording();
console.log("Result:", text);

API Reference

Constructor

new WebSTTTranscriber()

Automatically detects browser support.

Methods

startRecording(options?): Promise<void>

Start speech recognition.

await transcriber.startRecording({ language: "en-US" });

Options:

  • language?: string - Language code (e.g., "en-US", "ko-KR", "ja-JP")

stopRecording(): Promise<string>

Stop recognition and return transcribed text.

const transcription = await transcriber.stopRecording();
console.log("Result:", transcription);

Returns: Promise<string> - Transcribed text

isRecording(): boolean

Check if currently recording.

if (transcriber.isRecording()) {
  console.log("Recording in progress...");
}

isSupportedBrowser(): boolean

Check if Web Speech API is supported.

if (!transcriber.isSupportedBrowser()) {
  alert("Speech recognition is not supported in this browser");
}

Browser Support

Web Speech API is supported in:

| Browser | Support | Notes | |---------|---------|-------| | Chrome/Edge | ✅ Full support | Recommended | | Safari | ⚠️ Limited support | Some features restricted | | Firefox | ❌ Not supported | No Web Speech API |

See MDN Web Docs for detailed browser compatibility.

Supported Languages

Common language codes:

| Language | Code | |----------|------| | English (US) | en-US | | English (UK) | en-GB | | Korean | ko-KR | | Japanese | ja-JP | | Chinese (Simplified) | zh-CN | | Spanish | es-ES | | French | fr-FR | | German | de-DE | | Italian | it-IT | | Portuguese | pt-BR |

The available languages depend on the browser and operating system.

Integration with Charivo

import { Charivo } from "@charivo/core";
import { createSTTManager } from "@charivo/stt-core";
import { createWebSTTTranscriber } from "@charivo/stt-transcriber-web";

const charivo = new Charivo();

// Setup STT
const transcriber = createWebSTTTranscriber();
const sttManager = createSTTManager(transcriber);
charivo.attachSTT(sttManager);

// Voice input flow
await sttManager.start({ language: "en-US" });
const userMessage = await sttManager.stop();
await charivo.userSay(userMessage);
// → Character responds with voice and animation

Complete Example (React)

import { useState } from "react";
import { createWebSTTTranscriber } from "@charivo/stt-transcriber-web";
import { createSTTManager } from "@charivo/stt-core";

const transcriber = createWebSTTTranscriber();
const sttManager = createSTTManager(transcriber);

function VoiceInput() {
  const [recording, setRecording] = useState(false);
  const [transcription, setTranscription] = useState("");
  const [error, setError] = useState<string | null>(null);

  const handleStart = async () => {
    if (!transcriber.isSupportedBrowser()) {
      setError("Speech recognition is not supported in this browser");
      return;
    }

    try {
      setError(null);
      await sttManager.start({ language: "en-US" });
      setRecording(true);
    } catch (err) {
      setError("Failed to start recording");
    }
  };

  const handleStop = async () => {
    try {
      const text = await sttManager.stop();
      setTranscription(text);
      setRecording(false);
    } catch (err) {
      setError("Failed to transcribe");
      setRecording(false);
    }
  };

  return (
    <div>
      <button onClick={recording ? handleStop : handleStart}>
        {recording ? "🛑 Stop" : "🎤 Record"}
      </button>
      {recording && <div>🔴 Recording...</div>}
      {transcription && <div>Result: {transcription}</div>}
      {error && <div className="error">{error}</div>}
    </div>
  );
}

Error Handling

try {
  await sttManager.start({ language: "en-US" });
  const text = await sttManager.stop();
} catch (error) {
  if (!transcriber.isSupportedBrowser()) {
    console.error("Browser doesn't support Web Speech API");
    // Fallback to OpenAI or Remote transcriber
  } else if (error.name === "NotAllowedError") {
    console.error("Microphone permission denied");
  } else {
    console.error("Speech recognition error:", error);
  }
}

Common errors:

  • NotAllowedError - Microphone permission denied
  • NotFoundError - No microphone device available
  • AbortError - Recognition aborted
  • Browser not supported - Use OpenAI/Remote transcriber instead

Advantages

  1. Completely Free: No API keys or server required
  2. Real-Time: Fast recognition speed
  3. Privacy: Audio not sent to external servers (browser-dependent)
  4. Simple: Works out of the box

Limitations

  1. Browser Dependency: Only works well in Chrome/Edge
  2. Internet Required: Most browsers require internet connection
  3. Accuracy: May be less accurate than OpenAI Whisper
  4. User Environment: Depends on user's browser settings

For higher accuracy or Firefox support, use @charivo/stt-transcriber-openai or @charivo/stt-transcriber-remote.

When to Use

Use Web STT Transcriber when:

  • 🆓 Cost savings is important
  • ⚡ Real-time recognition is needed
  • 🔒 Privacy is a priority
  • 🎯 Prototyping or personal projects
  • ✅ Users primarily use Chrome/Edge

Use Other Transcribers when:

  • 🎯 High accuracy is essential → OpenAI
  • 🦊 Firefox support is required → OpenAI/Remote
  • 🏢 Consistent quality across browsers → Remote
  • 🎬 Need to transcribe recorded audio → OpenAI/Remote

Performance Tips

  1. Clear Speech: Speak clearly and at normal pace
  2. Quiet Environment: Minimize background noise
  3. Specify Language: Use accurate language codes
  4. Use Chrome/Edge: Recommended browsers for best results

Related Packages

License

MIT