Skip to content

munshkr/threejs-3d-sound-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

threejs-3d-sound-sandbox

See Demo

Testing filters on a ThreeJS PositionalAudio object (WebAudio Panner wrapper), to get a richer 3D sound simulation.

For now, there is a Low shelf filter implemented with the BiquadFilterNode, that changes its frequency dynamically based on the camera and mesh distance. By default, the distance model used is the same as the one set to the Panner/PositionalAudio object (either "linear", "inverse" or "exponential").

Usage

See jsm/PositionalAudioFilter.js for the actual class that implements the filters.

To use:

const camera = new THREE.PerspectiveCamera(...);
const listener = new THREE.AudioListener();
camera.add(listener);

...

const sound = new THREE.PositionalAudio(listener);
const filter = new PositionalAudioFilter(sound);

filter.connect();

Then, when the camera moves, you should call filter.update(), to update frequency based on distance.

Attributions

This example was based on the ThreeJS WebAudio sandbox example.

License

See LICENSE.

About

ThreeJS example of 3D sound simulation using PositionalAudio and extra filters

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages