whatisgithub

What is libopus-wasm?

openclaw/libopus-wasm — explained in plain English

Analysis updated 2026-05-18

78JavaScriptAudience · developerComplexity · 2/5Setup · easy

In one sentence

A JavaScript library that runs the Opus audio codec in browsers and Node.js via WebAssembly, letting apps encode and decode real-time voice audio without native compilation.

Mindmap

mindmap
  root((repo))
    What it does
      Encodes Opus audio
      Decodes Opus audio
      Runs via WebAssembly
    Tech stack
      JavaScript
      WebAssembly
      Emscripten
    Use cases
      Voice chat apps
      Discord bot audio
      Real-time streaming
    Audience
      Web developers
      Node.js developers
    Features
      Loss recovery FEC
      Bitrate tuning
      discord.js adapter

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add real-time voice encoding and decoding to a browser-based chat app.

USE CASE 2

Replace @discordjs/opus in a Discord bot without needing a C++ build toolchain.

USE CASE 3

Build a Node.js voice server that streams Opus-encoded audio over a network.

USE CASE 4

Enable packet loss recovery in a voice app using the built-in Forward Error Correction option.

What is it built with?

JavaScriptWebAssemblyNode.jsEmscripten

How does it compare?

openclaw/libopus-wasmbwjoke/fomo5000.comjoeseesun/qiaomu-userscripts
Stars787977
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedevelopergeneralgeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Pre-compiled npm package works out of the box, only building from source requires Emscripten.

The explanation does not state a license for this repository.

So what is it?

libopus-wasm is a JavaScript library that brings the Opus audio codec to browsers and Node.js applications without requiring any native compilation. Opus is a widely used audio format for real-time voice and music transmission, and this library packages the official C reference implementation (libopus) as a single-file WebAssembly module that works identically in a browser or on a Node.js server. The main use case is voice communication: the default settings encode audio at 48 kHz stereo with 20 ms frames, which is the standard configuration for voice-over-IP and real-time chat. You create an encoder, feed it raw audio samples as either 16-bit integers or 32-bit floats depending on what your audio pipeline produces, and receive compact Opus packets ready to send over a network. On the receiving end, a decoder turns those packets back into audio samples. Both factories share a single WebAssembly module instance that loads once and remains available for all subsequent calls. The library supports loss recovery. You can enable in-band Forward Error Correction (FEC), which embeds partial recovery data in each packet so the decoder can partially reconstruct audio from a lost packet using the next one that arrives. If no recovery data is available, the decoder can synthesize a concealment frame to fill the gap without a harsh audio dropout. Tuning options include variable or constant bitrate, complexity level (trading CPU usage for audio quality), signal type (voice versus music), bandwidth constraints, and discontinuous transmission to stop sending packets during silence. A control passthrough exposes less common encoder and decoder settings directly. For discord.js users, the library includes a compatibility adapter that matches the API shape of the existing @discordjs/opus package, making it a drop-in replacement that does not require a C++ compiler or build toolchain. The npm package ships pre-compiled output, so most users never need to build from source. Building from source requires Emscripten. The library is ESM-only and requires Node.js 20 or any current browser.

Copy-paste prompts

Prompt 1
Show me how to encode raw 16-bit PCM audio into Opus packets using libopus-wasm.
Prompt 2
Use libopus-wasm as a drop-in replacement for @discordjs/opus in my discord.js bot.
Prompt 3
Set up an Opus encoder and decoder pair in Node.js with 48 kHz stereo and 20 ms frames.
Prompt 4
Enable in-band FEC in libopus-wasm so my voice app can recover from lost packets.

Frequently asked questions

What is libopus-wasm?

A JavaScript library that runs the Opus audio codec in browsers and Node.js via WebAssembly, letting apps encode and decode real-time voice audio without native compilation.

What language is libopus-wasm written in?

Mainly JavaScript. The stack also includes JavaScript, WebAssembly, Node.js.

What license does libopus-wasm use?

The explanation does not state a license for this repository.

How hard is libopus-wasm to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is libopus-wasm for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.