Skip to content

Build Instructions

This page explains how to build three-steam-audio from source. Most users can install the package from npm and skip this section.

Building the project involves three main stages:

  1. Steam Audio core — download dependencies and build the Steam Audio SDK as a WebAssembly static library.
  2. WASM bindings — generate TypeScript declarations and compile the C bridge into phonon_bindings.wasm / phonon_bindings.js.
  3. npm packages — build the TypeScript source and the documentation site.

The recommended development environment is managed with Nix. The project’s flake.nix provides cmake, emscripten, just, ninja, and other native tools.

  • Nix package manager with flakes enabled
  • pnpm
  • Node.js 24 or later
  • Git with submodules support

three-steam-audio includes the Steam Audio SDK as a Git submodule. Clone recursively so the steam-audio/ directory is populated.

Terminal window
git clone --recursive https://github.com/kwaa/three-steam-audio.git
cd three-steam-audio

If you already cloned without submodules, initialize them afterwards:

Terminal window
git submodule update --init --recursive

From the repository root, enter the Nix shell to get the required build tools:

Terminal window
nix develop

This sets STEAMAUDIO_ROOT to $PWD/steam-audio and puts emcc, cmake, just, and ninja on your path.

Terminal window
pnpm install

Download the Steam Audio dependencies for WebAssembly and build the core library:

Terminal window
just get_dependencies
just build-steam-audio

just build-steam-audio applies two small patches automatically:

  • patches/steam-audio/flatbuffers-1.12-table-key-comparator.patch
  • patches/steam-audio/emscripten-synchronous-thread-pool.patch

The build produces static libraries under steam-audio/core/bin/lib/wasm/ and headers under steam-audio/core/bin/include/.

Generate TypeScript types and compile the C bindings into the package source tree:

Terminal window
just build-bindings

This writes the following files to packages/three-steam-audio/src/bindings/:

  • phonon_bindings.js
  • phonon_bindings.wasm
  • phonon_bindings.d.ts

Compile the TypeScript source:

Terminal window
pnpm build

This builds the three-steam-audio package and any workspace dependents.

Terminal window
pnpm typecheck
pnpm lint
pnpm test
Terminal window
pnpm dev:docs # development server
pnpm -F docs build # static build
Terminal window
pnpm dev:example-react

This starts the interactive demo in examples/react/, which shows HRTF spatialization, occlusion, transmission, and parametric reflections.

The .github/workflows/check.yml pipeline performs the following steps on every pull request:

Terminal window
nix develop --command just get_dependencies build-steam-audio build-bindings
pnpm build
pnpm typecheck
pnpm lint
pnpm test
npm pack --dry-run