Browser and NodeJS Web Assembly audio decoder libraries that are highly optimized for size and performance.
See the codeWASM Audio Decoders is a collection of Web Assembly audio decoder libraries that are highly optimized for browser use. Each module supports synchronous decoding on the main thread as well as asynchronous (threaded) decoding through a built in Web Worker implementation.
Web Assembly is a binary instruction format for a stack-based virtual machine that allows for near native code execution speed inside of a web browser. In practice, these decoders are just as fast, and in some cases faster, than the browser implementation.
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.
Pre-built minified JS files are available from NPM and in each decoder's dist folder.
mpg123-decoderDecodes MPEG Layer I/II/III into PCM
mpg123@wasm-audio-decoders/flacDecodes FLAC and Ogg FLAC data into PCM
libFLAC and codec-parserogg-opus-decoderDecodes Ogg Opus data into PCM
libopus and codec-parseropus-decoderDecodes raw Opus audio frames into PCM
libopus@wasm-audio-decoders/opus-mlDecodes raw Opus audio frames into PCM with Machine Learning enhancements
libopus@wasm-audio-decoders/ogg-vorbisDecodes Ogg Vorbis data into PCM
libvorbis and codec-parser@wasm-audio-decoders/aacDecodes AAC data into PCM
esds boxfaad2 and codec-parsergit submodule update --init to clone the git sub-modules.git clone https://github.com/eshaz/wasm-audio-decoders.git
cd wasm-audio-decoders
git submodule update --init
npm install to install the build dependencies.npm run install-decoders to install the dependencies for each decoder.npm install
npm run install-decoders
source the Emscripten path in the terminal you want build in.
$ source path_to_your_emscripten_installation/emsdk_env.shnpm run configure to configure the libraries. (only required for first time build, or after updating the Makefile)npm run build to build the libraries.
dist folder.# only required for first time build, OR after updating the `Makefile`
npm run configure
# builds the project
npm run build
npm run test to run the test suite.npm run test
Makefile or changed any of the submodules, make sure to configure the project.npm run test.All contributions are welcome!
All contributes / interactions with this repository must follow the code of conduct.
OggOpusDecoder was originally based on AnthumChris/opus-stream-decoder.
puff is included as a WASM build from madler/zlib and is used to decompress the WASM binary.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 libraries included as git submodules and compiled into the dist files, may have different licensing terms.
536 followers · starred Oct 2024
25,624 followers · starred Feb 2022
425 followers · starred Aug 2025
87 followers · starred Mar 2025
Browser and NodeJS Web Assembly audio decoder libraries that are highly optimized for size and performance.
See the codeWASM Audio Decoders is a collection of Web Assembly audio decoder libraries that are highly optimized for browser use. Each module supports synchronous decoding on the main thread as well as asynchronous (threaded) decoding through a built in Web Worker implementation.
Web Assembly is a binary instruction format for a stack-based virtual machine that allows for near native code execution speed inside of a web browser. In practice, these decoders are just as fast, and in some cases faster, than the browser implementation.
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.
Pre-built minified JS files are available from NPM and in each decoder's dist folder.
mpg123-decoderDecodes MPEG Layer I/II/III into PCM
mpg123@wasm-audio-decoders/flacDecodes FLAC and Ogg FLAC data into PCM
libFLAC and codec-parserogg-opus-decoderDecodes Ogg Opus data into PCM
libopus and codec-parseropus-decoderDecodes raw Opus audio frames into PCM
libopus@wasm-audio-decoders/opus-mlDecodes raw Opus audio frames into PCM with Machine Learning enhancements
libopus@wasm-audio-decoders/ogg-vorbisDecodes Ogg Vorbis data into PCM
libvorbis and codec-parser@wasm-audio-decoders/aacDecodes AAC data into PCM
esds boxfaad2 and codec-parsergit submodule update --init to clone the git sub-modules.git clone https://github.com/eshaz/wasm-audio-decoders.git
cd wasm-audio-decoders
git submodule update --init
npm install to install the build dependencies.npm run install-decoders to install the dependencies for each decoder.npm install
npm run install-decoders
source the Emscripten path in the terminal you want build in.
$ source path_to_your_emscripten_installation/emsdk_env.shnpm run configure to configure the libraries. (only required for first time build, or after updating the Makefile)npm run build to build the libraries.
dist folder.# only required for first time build, OR after updating the `Makefile`
npm run configure
# builds the project
npm run build
npm run test to run the test suite.npm run test
Makefile or changed any of the submodules, make sure to configure the project.npm run test.All contributions are welcome!
All contributes / interactions with this repository must follow the code of conduct.
OggOpusDecoder was originally based on AnthumChris/opus-stream-decoder.
puff is included as a WASM build from madler/zlib and is used to decompress the WASM binary.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 libraries included as git submodules and compiled into the dist files, may have different licensing terms.
536 followers · starred Oct 2024
25,624 followers · starred Feb 2022
425 followers · starred Aug 2025
87 followers · starred Mar 2025