Skip to content

A wasm opus decoder and opus encoder made for browser audio worklets.

License

Notifications You must be signed in to change notification settings

MinceraftMC/SonusOpusWasm

WASM Opus Decoder/Encoder

A wasm opus decoder and opus encoder based on eshaz/wasm-audio-decoders's opus decoder.

Each decoder is built with inline WASM to reduce bundling complexity with transpilers like Webpack. The inlined WASM is encoded using yEnc for efficient binary encoding and is gzip compressed for reduced file size.

Opus Decoder

Decodes raw Opus audio frames into PCM

  • 85.4 KiB minified bundle size
  • Browser and NodeJS support
  • Built in Web Worker support
  • Multichannel decoding (up to 255 channels)
  • Based on libopus

Opus Encoder

Encodes PCM into raw Opus audio frames

  • 152.2 KiB minified bundle size
  • Browser and NodeJS support
  • Built in Web Worker support
  • Based on libopus

Developing

Prerequisites

  1. Linux, or a Linux-like environment to build (i.e. WSL).
  2. NodeJS 18.x or higher.
  3. Docker for compiling with correct dependencies (recommended)

Initial Setup

  1. Clone this repo.
  2. Change directory to this repo and run git submodule update --init to clone the git sub-modules.
git clone https://github.com/MinceraftMC/SonusOpusWasm.git
cd SonusOpusWasm
git submodule update --init

Installing Dependencies

  1. Run yarn install to install the build dependencies.
  2. Run yarn run install-coders to install the dependencies for each submodule.
yarn install
yarn run install-coders

Building

Just run compile-opus.sh with the BUILD_DOCKER_IMAGE environment variable set to any non-empty value.

BUILD_DOCKER_IMAGE=1 ./compile-opus.sh

Rebuilding after changes

  1. Make your changes
  2. If you updated any dependencies, make sure to install them.
  3. If you updated any configuration in the Makefile or changed any of the submodules, make sure to configure the project.
  4. Rebuild the project.

Contributing

All contributions are welcome! Please keep in mind that this repository is just a fork of eshaz/wasm-audio-decoders.

Licensing

The source code that originates in this project is licensed under the MIT license. Please note that any external source code included by repository, such as the decoding/encoding libraries included as git submodules and compiled into the dist files, may have different licensing terms.

About

A wasm opus decoder and opus encoder made for browser audio worklets.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Contributors 2

  •  
  •