Easy 3 kB library for 98% accurate Gameboy audio

Usage no npm install needed!

<script type="module">
  import apu from 'https://cdn.skypack.dev/apu';



Want some hardware-accurate Gameboy music and sounds in your HTML5 game or app? Don't want to load megabytes of .mp3 files? Overwhelmed or frustrated by the Web Audio API? Welcome to apu!


  • Tiny; single file, about 9 kB (gzip)
  • Supports playing .vgm files (which are typically a few kB after gzip)
  • Mute BGM channels while playing SFX
  • Highly performant
    • Fast sample generation in WebAssembly
    • When possible, uses AudioWorklet to run completely outside the main thread (works in latest Chrome and FireFox)
  • ES module
  • TypeScript bindings

Browser support

Latest Chrome, Safari, Firefox


To develop this project you'll need:

  • Unix system (MacOS and Ubuntu definitely work)
  • Node 12+ (older versions may work but untested)
  • Make
  • Clang
  • LLVM 8+ (should include wasm-ld; or, on Ubuntu 20.04, wasm-ld-10)
  • Binaryen (should include wasm-opt)

To build it:


To watch & rebuild:

npm run watch

To watch, rebuild, and run a live-updating web server:

npm start


  • On Mac, when installing llvm through Brew, you might find that wasm-ld is still not available. Try brew link --force llvm


The high-performance WebAssembly bundle for emulating the GameBoy's APU is compiled from C code that was adapted from an old version of VGMPlay, which was written by Anthony Kruize in 2002. Without that code, this module would not be nearly as performant nor as accurate as it is today.


BSD 3-Clause