# Satie in React Three Fiber

Use the same sound scene and Three.js adapter through a component that owns loading, frame updates and cleanup.

Browser runtime

[Documentation](https://www.satie.world/docs/react)

## 1. Prepare the scene

Ask your coding agent to use satie_setup for r3f. Install the runtime and load the exported scene.contract.json before mounting the audio component.

Terminal

```
npm install https://www.satie.world/runtime/0.4.15/satie-runtime.tgz
```

## 2. Mount once inside Canvas

Keep the contract and bindings stable between renders. SatieAudio loads the scene, follows the camera each frame and disposes on unmount. Enable Start sound only after onReady supplies the audio instance.

React · World and contract are supplied by your project

```
import { useState } from "react";
import { Canvas } from "@react-three/fiber";
import { SatieAudio } from "satie-runtime/react";
import type { SatieScene } from "satie-runtime/three";

// Inside your component:
const [audio, setAudio] = useState<SatieScene | null>(null);
return <>
  <button disabled={!audio} onClick={() => { void audio?.start(); }}>
    Start sound
  </button>
  <Canvas>
    <World />
    <SatieAudio contract={contract} onReady={setAudio}
      onError={console.error} />
  </Canvas>
</>;
```

## 3. Use the ready instance

Send gameplay events and signals through the instance returned by onReady. Use listener, listenerOffset and listenerOrientation when the ears belong to a character rather than the render camera. For local editing, pass the mixer prop only in development.

[Component props](/developers/reference/react.d.ts) · [Three.js events and release steps](/docs/web)

## Support and validation

Maintained React wrapper over the browser runtime; component and adapter tests.

Mount inside Canvas, wait for onReady and start audio from a user gesture. Uses the web runtime.

Not yet validated: Check the browser and device used by your project.
