Reflections and Reverb
Three Steam Audio can simulate how sound reflects off surrounding geometry. This produces two renderable effects:
- Per-source reflections — indirect sound that reaches the listener from a specific source.
- Listener reverb — ambient reverberation at the listener position.
Both effects use Steam Audio’s parametric reflection effect. Convolution or hybrid reflection effects are not supported in this version because their IR handles cannot cross independent WASM runtimes.
Enabling reflections
Section titled “Enabling reflections”Reflections must be enabled when the world is created. Choose upper bounds for rays, duration, and Ambisonic order; these reserve native memory.
import { const createWorld: (options: WorldOptions) => Promise<World>
createWorld } from 'three-steam-audio'
const const audioContext: AudioContext
audioContext = new var AudioContext: new (contextOptions?: AudioContextOptions) => AudioContext
The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode.
AudioContext()
const const world: World
world = await function createWorld(options: WorldOptions): Promise<World>
createWorld({ WorldOptions.audioContext: AudioContext
audioContext, WorldOptions.reflections?: false | { diffuseSamples?: number; maxDuration?: number; maxOrder?: number; maxRays?: number;} | undefined
reflections: { maxRays?: number | undefined
maxRays: 4096, maxDuration?: number | undefined
maxDuration: 2, maxOrder?: number | undefined
maxOrder: 1, diffuseSamples?: number | undefined
diffuseSamples: 32, },})import { const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense, function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState } from 'react'import { function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas } from '@react-three/fiber'import { const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio } from 'three-steam-audio/react'
export const const App: () => JSX.Element
App = () => { const [const audioContext: AudioContext
audioContext] = useState<AudioContext>(initialState: AudioContext | (() => AudioContext)): [AudioContext, Dispatch<SetStateAction<AudioContext>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState(() => new var AudioContext: new (contextOptions?: AudioContextOptions) => AudioContext
The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode.
AudioContext())
return ( <function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas> <const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense SuspenseProps.fallback?: ReactNode
A fallback react tree to show when a Suspense child (like React.lazy) suspends
fallback={null}> <const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio audioContext: AudioContext
audioContext={const audioContext: AudioContext
audioContext} options?: Omit<WorldOptions, "audioContext"> | undefined
options={{ reflections?: false | { diffuseSamples?: number; maxDuration?: number; maxOrder?: number; maxRays?: number;} | undefined
reflections: { maxRays?: number | undefined
maxRays: 4096, maxDuration?: number | undefined
maxDuration: 2, maxOrder?: number | undefined
maxOrder: 1, diffuseSamples?: number | undefined
diffuseSamples: 32, }, }} > {/* scene contents */} </const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio> </const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense> </function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas> )}Reflection buses
Section titled “Reflection buses”A ReflectionBusNode renders per-source reflections. Create one from the world, connect it to the audio destination, then connect each source to it.
import { const createWorld: (options: WorldOptions) => Promise<World>
createWorld } from 'three-steam-audio'
const const audioContext: AudioContext
audioContext = new var AudioContext: new (contextOptions?: AudioContextOptions) => AudioContext
The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode.
AudioContext()const const world: World
world = await function createWorld(options: WorldOptions): Promise<World>
createWorld({ WorldOptions.audioContext: AudioContext
audioContext, WorldOptions.reflections?: false | { diffuseSamples?: number; maxDuration?: number; maxOrder?: number; maxRays?: number;} | undefined
reflections: { maxRays?: number | undefined
maxRays: 4096, maxDuration?: number | undefined
maxDuration: 2, maxOrder?: number | undefined
maxOrder: 1, diffuseSamples?: number | undefined
diffuseSamples: 32, },})
const const reflections: ReflectionBusNode
reflections = const world: World
world.function createReflectionBus(settings?: ReflectionBusSettings): ReflectionBusNode
createReflectionBus({ ReflectionBusSettings.wet?: number | undefined
wet: 1 })const reflections: ReflectionBusNode
reflections.AudioNode.connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode (+1 overload)
The connect() method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
connect(const audioContext: AudioContext
audioContext.BaseAudioContext.destination: AudioDestinationNode
The destination property of the BaseAudioContext interface returns an AudioDestinationNode representing the final destination of all audio in the context. It often represents an actual audio-rendering device such as your device's speakers.
destination)
const const source: Source
source = const world: World
world.function createSource(settings?: SourceSettings): Source
createSource({ SourceSettings.reflections?: boolean | ReflectionSettings | undefined
reflections: { ReflectionSettings.wet?: number | undefined
wet: 0.7 } })const const node: SteamAudioNode
node = const world: World
world.function createNode(sourceValue: Source): SteamAudioNode
createNode(const source: Source
source)
const const oscillator: OscillatorNode
oscillator = new var OscillatorNode: new (context: BaseAudioContext, options?: OscillatorOptions) => OscillatorNode
The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone.
OscillatorNode(const audioContext: AudioContext
audioContext, { OscillatorOptions.frequency?: number | undefined
frequency: 440 })const oscillator: OscillatorNode
oscillator.AudioNode.connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode (+1 overload)
The connect() method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
connect(const node: SteamAudioNode
node)const node: SteamAudioNode
node.AudioNode.connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode (+1 overload)
The connect() method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
connect(const audioContext: AudioContext
audioContext.BaseAudioContext.destination: AudioDestinationNode
The destination property of the BaseAudioContext interface returns an AudioDestinationNode representing the final destination of all audio in the context. It often represents an actual audio-rendering device such as your device's speakers.
destination)const oscillator: OscillatorNode
oscillator.AudioScheduledSourceNode.start(when?: number): void
The start() method on AudioScheduledSourceNode schedules a sound to begin playback at the specified time. If no time is specified, then the sound begins playing immediately.
start()
const const connection: ReflectionConnection
connection = const node: SteamAudioNode
node.SteamAudioNode.connectReflections(bus: ReflectionBusNode, options?: { gain?: number;}): ReflectionConnection
connectReflections(const reflections: ReflectionBusNode
reflections, { gain?: number | undefined
gain: 1 })
// Later, change the send level:const connection: ReflectionConnection
connection.ReflectionConnection.setGain: (gain: number) => void
setGain(0.5)
// To disconnect:// connection.disconnect()import { const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense, function useEffect(effect: EffectCallback, deps?: DependencyList): void
Accepts a function that contains imperative, possibly effectful code.
useEffect, function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState } from 'react'import { function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas } from '@react-three/fiber'import { const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio, const SteamAudioEnvironment: ({ children, destination, reflections, reverb }: SteamAudioEnvironmentProps) => import("react").JSX.Element
SteamAudioEnvironment, const SteamAudioListener: ({ object }: SteamAudioListenerProps) => null
SteamAudioListener, const SteamAudioSource: { ({ airAbsorption, destination, directivity, hrtf, input, occlusion, onReady, ref, reflections, reflectionSend, reverbSend, settings, spatialBlend, transmission, ...groupProps }: SteamAudioSourceProps): import("react").JSX.Element; displayName: string;}
SteamAudioSource,} from 'three-steam-audio/react'
export const const App: () => JSX.Element | null
App = () => { const [const audioContext: AudioContext
audioContext] = useState<AudioContext>(initialState: AudioContext | (() => AudioContext)): [AudioContext, Dispatch<SetStateAction<AudioContext>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState(() => new var AudioContext: new (contextOptions?: AudioContextOptions) => AudioContext
The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode.
AudioContext()) const [const input: AudioNode | null
input, const setInput: Dispatch<SetStateAction<AudioNode | null>>
setInput] = useState<AudioNode | null>(initialState: AudioNode | (() => AudioNode | null) | null): [AudioNode | null, Dispatch<SetStateAction<AudioNode | null>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState<interface AudioNode
The AudioNode interface is a generic interface for representing an audio processing module.
AudioNode | null>(null)
function useEffect(effect: EffectCallback, deps?: DependencyList): void
Accepts a function that contains imperative, possibly effectful code.
useEffect(() => { const const oscillator: OscillatorNode
oscillator = new var OscillatorNode: new (context: BaseAudioContext, options?: OscillatorOptions) => OscillatorNode
The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone.
OscillatorNode(const audioContext: AudioContext
audioContext, { OscillatorOptions.frequency?: number | undefined
frequency: 440 }) const oscillator: OscillatorNode
oscillator.AudioScheduledSourceNode.start(when?: number): void
The start() method on AudioScheduledSourceNode schedules a sound to begin playback at the specified time. If no time is specified, then the sound begins playing immediately.
start() const setInput: (value: SetStateAction<AudioNode | null>) => void
setInput(const oscillator: OscillatorNode
oscillator) return () => const oscillator: OscillatorNode
oscillator.AudioScheduledSourceNode.stop(when?: number): void
The stop() method on AudioScheduledSourceNode schedules a sound to cease playback at the specified time. If no time is specified, then the sound stops playing immediately.
stop() }, [const audioContext: AudioContext
audioContext])
if (!const input: AudioNode | null
input) return null
return ( <function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas> <const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense SuspenseProps.fallback?: ReactNode
A fallback react tree to show when a Suspense child (like React.lazy) suspends
fallback={null}> <const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio audioContext: AudioContext
audioContext={const audioContext: AudioContext
audioContext} options?: Omit<WorldOptions, "audioContext"> | undefined
options={{ reflections?: false | { diffuseSamples?: number; maxDuration?: number; maxOrder?: number; maxRays?: number;} | undefined
reflections: { maxRays?: number | undefined
maxRays: 4096 } }} > <const SteamAudioListener: ({ object }: SteamAudioListenerProps) => null
SteamAudioListener /> <const SteamAudioEnvironment: ({ children, destination, reflections, reverb }: SteamAudioEnvironmentProps) => import("react").JSX.Element
SteamAudioEnvironment SteamAudioEnvironmentProps.reflections?: boolean | ReflectionBusSettings | undefined
reflections={{ ReflectionBusSettings.wet?: number | undefined
wet: 1 }}> <const SteamAudioSource: { ({ airAbsorption, destination, directivity, hrtf, input, occlusion, onReady, ref, reflections, reflectionSend, reverbSend, settings, spatialBlend, transmission, ...groupProps }: SteamAudioSourceProps): import("react").JSX.Element; displayName: string;}
SteamAudioSource SteamAudioSourceProps.input?: AudioNode | null | undefined
input={const input: AudioNode
input} SteamAudioSourceProps.reflections?: boolean | ReflectionSettings | undefined
reflections={{ ReflectionSettings.wet?: number | undefined
wet: 0.7 }} SteamAudioSourceProps.reflectionSend?: number | undefined
reflectionSend={1} position?: number | Vector3 | [x: number, y: number, z: number] | readonly [x: number, y: number, z: number] | Readonly<Vector3> | undefined
Object's local position.
position={[0, 1, -2]} /> </const SteamAudioEnvironment: ({ children, destination, reflections, reverb }: SteamAudioEnvironmentProps) => import("react").JSX.Element
SteamAudioEnvironment> </const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio> </const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense> </function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas> )}Reverb bus
Section titled “Reverb bus”A ReverbBusNode renders listener-centric reverb. Enable listener reverb, create a reverb bus, and connect sources to it.
import { const createWorld: (options: WorldOptions) => Promise<World>
createWorld } from 'three-steam-audio'
const const audioContext: AudioContext
audioContext = new var AudioContext: new (contextOptions?: AudioContextOptions) => AudioContext
The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode.
AudioContext()const const world: World
world = await function createWorld(options: WorldOptions): Promise<World>
createWorld({ WorldOptions.audioContext: AudioContext
audioContext, WorldOptions.reflections?: false | { diffuseSamples?: number; maxDuration?: number; maxOrder?: number; maxRays?: number;} | undefined
reflections: { maxRays?: number | undefined
maxRays: 4096 },})
const world: World
world.listener: Listener
listener.Listener.setReverb: (settings: false | ReverbSettings) => void
setReverb({ ReverbSettings.reverbScale?: ThreeBand | undefined
reverbScale: [1.8, 1.6, 1.3],})
const const reverb: ReverbBusNode
reverb = const world: World
world.function createReverbBus(settings?: ReverbBusSettings): ReverbBusNode
createReverbBus({ ReverbBusSettings.wet?: number | undefined
wet: 1 })const reverb: ReverbBusNode
reverb.AudioNode.connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode (+1 overload)
The connect() method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
connect(const audioContext: AudioContext
audioContext.BaseAudioContext.destination: AudioDestinationNode
The destination property of the BaseAudioContext interface returns an AudioDestinationNode representing the final destination of all audio in the context. It often represents an actual audio-rendering device such as your device's speakers.
destination)
const const source: Source
source = const world: World
world.function createSource(settings?: SourceSettings): Source
createSource()const const node: SteamAudioNode
node = const world: World
world.function createNode(sourceValue: Source): SteamAudioNode
createNode(const source: Source
source)
const const oscillator: OscillatorNode
oscillator = new var OscillatorNode: new (context: BaseAudioContext, options?: OscillatorOptions) => OscillatorNode
The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone.
OscillatorNode(const audioContext: AudioContext
audioContext, { OscillatorOptions.frequency?: number | undefined
frequency: 440 })const oscillator: OscillatorNode
oscillator.AudioNode.connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode (+1 overload)
The connect() method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
connect(const node: SteamAudioNode
node)const node: SteamAudioNode
node.AudioNode.connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode (+1 overload)
The connect() method of the AudioNode interface lets you connect one of the node's outputs to a target, which may be either another AudioNode (thereby directing the sound data to the specified node) or an AudioParam, so that the node's output data is automatically used to change the value of that parameter over time.
connect(const audioContext: AudioContext
audioContext.BaseAudioContext.destination: AudioDestinationNode
The destination property of the BaseAudioContext interface returns an AudioDestinationNode representing the final destination of all audio in the context. It often represents an actual audio-rendering device such as your device's speakers.
destination)const oscillator: OscillatorNode
oscillator.AudioScheduledSourceNode.start(when?: number): void
The start() method on AudioScheduledSourceNode schedules a sound to begin playback at the specified time. If no time is specified, then the sound begins playing immediately.
start()
const node: SteamAudioNode
node.SteamAudioNode.connectReverb(bus: ReverbBusNode, options?: { gain?: number;}): ReverbConnection
connectReverb(const reverb: ReverbBusNode
reverb, { gain?: number | undefined
gain: 0.4 })import { const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense, function useEffect(effect: EffectCallback, deps?: DependencyList): void
Accepts a function that contains imperative, possibly effectful code.
useEffect, function useState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState } from 'react'import { function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas } from '@react-three/fiber'import { const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio, const SteamAudioEnvironment: ({ children, destination, reflections, reverb }: SteamAudioEnvironmentProps) => import("react").JSX.Element
SteamAudioEnvironment, const SteamAudioListener: ({ object }: SteamAudioListenerProps) => null
SteamAudioListener, const SteamAudioSource: { ({ airAbsorption, destination, directivity, hrtf, input, occlusion, onReady, ref, reflections, reflectionSend, reverbSend, settings, spatialBlend, transmission, ...groupProps }: SteamAudioSourceProps): import("react").JSX.Element; displayName: string;}
SteamAudioSource,} from 'three-steam-audio/react'
export const const App: () => JSX.Element | null
App = () => { const [const audioContext: AudioContext
audioContext] = useState<AudioContext>(initialState: AudioContext | (() => AudioContext)): [AudioContext, Dispatch<SetStateAction<AudioContext>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState(() => new var AudioContext: new (contextOptions?: AudioContextOptions) => AudioContext
The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode.
AudioContext()) const [const input: AudioNode | null
input, const setInput: Dispatch<SetStateAction<AudioNode | null>>
setInput] = useState<AudioNode | null>(initialState: AudioNode | (() => AudioNode | null) | null): [AudioNode | null, Dispatch<SetStateAction<AudioNode | null>>] (+1 overload)
Returns a stateful value, and a function to update it.
useState<interface AudioNode
The AudioNode interface is a generic interface for representing an audio processing module.
AudioNode | null>(null)
function useEffect(effect: EffectCallback, deps?: DependencyList): void
Accepts a function that contains imperative, possibly effectful code.
useEffect(() => { const const oscillator: OscillatorNode
oscillator = new var OscillatorNode: new (context: BaseAudioContext, options?: OscillatorOptions) => OscillatorNode
The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone.
OscillatorNode(const audioContext: AudioContext
audioContext, { OscillatorOptions.frequency?: number | undefined
frequency: 440 }) const oscillator: OscillatorNode
oscillator.AudioScheduledSourceNode.start(when?: number): void
The start() method on AudioScheduledSourceNode schedules a sound to begin playback at the specified time. If no time is specified, then the sound begins playing immediately.
start() const setInput: (value: SetStateAction<AudioNode | null>) => void
setInput(const oscillator: OscillatorNode
oscillator) return () => const oscillator: OscillatorNode
oscillator.AudioScheduledSourceNode.stop(when?: number): void
The stop() method on AudioScheduledSourceNode schedules a sound to cease playback at the specified time. If no time is specified, then the sound stops playing immediately.
stop() }, [const audioContext: AudioContext
audioContext])
if (!const input: AudioNode | null
input) return null
return ( <function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas> <const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense SuspenseProps.fallback?: ReactNode
A fallback react tree to show when a Suspense child (like React.lazy) suspends
fallback={null}> <const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio audioContext: AudioContext
audioContext={const audioContext: AudioContext
audioContext} options?: Omit<WorldOptions, "audioContext"> | undefined
options={{ reflections?: false | { diffuseSamples?: number; maxDuration?: number; maxOrder?: number; maxRays?: number;} | undefined
reflections: { maxRays?: number | undefined
maxRays: 4096 } }} > <const SteamAudioListener: ({ object }: SteamAudioListenerProps) => null
SteamAudioListener /> <const SteamAudioEnvironment: ({ children, destination, reflections, reverb }: SteamAudioEnvironmentProps) => import("react").JSX.Element
SteamAudioEnvironment SteamAudioEnvironmentProps.reverb?: false | (ReverbBusSettings & ReverbSettings) | undefined
reverb={{ ReverbSettings.reverbScale?: ThreeBand | undefined
reverbScale: [1.8, 1.6, 1.3], ReverbBusSettings.wet?: number | undefined
wet: 1 }} > <const SteamAudioSource: { ({ airAbsorption, destination, directivity, hrtf, input, occlusion, onReady, ref, reflections, reflectionSend, reverbSend, settings, spatialBlend, transmission, ...groupProps }: SteamAudioSourceProps): import("react").JSX.Element; displayName: string;}
SteamAudioSource SteamAudioSourceProps.input?: AudioNode | null | undefined
input={const input: AudioNode
input} SteamAudioSourceProps.reverbSend?: number | undefined
reverbSend={0.4} position?: number | Vector3 | [x: number, y: number, z: number] | readonly [x: number, y: number, z: number] | Readonly<Vector3> | undefined
Object's local position.
position={[0, 1, -2]} /> </const SteamAudioEnvironment: ({ children, destination, reflections, reverb }: SteamAudioEnvironmentProps) => import("react").JSX.Element
SteamAudioEnvironment> </const SteamAudio: (props: SteamAudioProps) => import("react").JSX.Element
SteamAudio> </const Suspense: ExoticComponent<SuspenseProps>
Lets you display a fallback until its children have finished loading.
Suspense> </function Canvas(props: CanvasProps): import("react").JSX.Element
A DOM canvas which accepts threejs elements as children.
Canvas> )}Performance
Section titled “Performance”Reflection simulation is expensive. Three Steam Audio runs reflection tracing in a dedicated Worker when Worker is available and reflections are enabled. If the worker cannot be created, the simulation falls back to the main thread.
You can reduce CPU usage at runtime without recreating the world:
import { const createWorld: (options: WorldOptions) => Promise<World>
createWorld } from 'three-steam-audio'
const world: World
world.function setReflectionSettings(settings: RuntimeSimulationSettings): void
setReflectionSettings({ RuntimeSimulationSettings.rays?: number | undefined
rays: 1024, RuntimeSimulationSettings.bounces?: number | undefined
bounces: 4, RuntimeSimulationSettings.duration?: number | undefined
duration: 1, RuntimeSimulationSettings.order?: number | undefined
order: 0,})import { const useSteamAudio: () => SteamAudioContextValue
useSteamAudio } from 'three-steam-audio/react'
export const const Settings: () => null
Settings = () => { const { const world: World
world } = function useSteamAudio(): SteamAudioContextValue
useSteamAudio()
const world: World
world.function setReflectionSettings(settings: RuntimeSimulationSettings): void
setReflectionSettings({ RuntimeSimulationSettings.rays?: number | undefined
rays: 1024, RuntimeSimulationSettings.bounces?: number | undefined
bounces: 4, RuntimeSimulationSettings.duration?: number | undefined
duration: 1, RuntimeSimulationSettings.order?: number | undefined
order: 0, })
return null}Values are clamped to the maximums declared when the world was created.