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.
Overview
Section titled “Overview”Building the project involves three main stages:
- Steam Audio core — download dependencies and build the Steam Audio SDK as a WebAssembly static library.
- WASM bindings — generate TypeScript declarations and compile the C bridge into
phonon_bindings.wasm/phonon_bindings.js. - npm packages — build the TypeScript source and the documentation site.
Requirements
Section titled “Requirements”The recommended development environment is managed with Nix. The project’s flake.nix provides cmake, emscripten, just, ninja, and other native tools.
Clone the repository
Section titled “Clone the repository”three-steam-audio includes the Steam Audio SDK as a Git submodule. Clone recursively so the steam-audio/ directory is populated.
git clone --recursive https://github.com/kwaa/three-steam-audio.gitcd three-steam-audioIf you already cloned without submodules, initialize them afterwards:
git submodule update --init --recursiveEnter the development shell
Section titled “Enter the development shell”From the repository root, enter the Nix shell to get the required build tools:
nix developThis sets STEAMAUDIO_ROOT to $PWD/steam-audio and puts emcc, cmake, just, and ninja on your path.
Install JavaScript dependencies
Section titled “Install JavaScript dependencies”pnpm installBuild the Steam Audio core
Section titled “Build the Steam Audio core”Download the Steam Audio dependencies for WebAssembly and build the core library:
just get_dependenciesjust build-steam-audiojust build-steam-audio applies two small patches automatically:
patches/steam-audio/flatbuffers-1.12-table-key-comparator.patchpatches/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/.
Build the WASM bindings
Section titled “Build the WASM bindings”Generate TypeScript types and compile the C bindings into the package source tree:
just build-bindingsThis writes the following files to packages/three-steam-audio/src/bindings/:
phonon_bindings.jsphonon_bindings.wasmphonon_bindings.d.ts
Build the packages
Section titled “Build the packages”Compile the TypeScript source:
pnpm buildThis builds the three-steam-audio package and any workspace dependents.
Run checks
Section titled “Run checks”pnpm typecheckpnpm lintpnpm testBuild the documentation
Section titled “Build the documentation”pnpm dev:docs # development serverpnpm -F docs build # static buildRun the React example
Section titled “Run the React example”pnpm dev:example-reactThis starts the interactive demo in examples/react/, which shows HRTF spatialization, occlusion, transmission, and parametric reflections.
CI summary
Section titled “CI summary”The .github/workflows/check.yml pipeline performs the following steps on every pull request:
nix develop --command just get_dependencies build-steam-audio build-bindingspnpm buildpnpm typecheckpnpm lintpnpm testnpm pack --dry-run