Spatial Audio and Scene Efficiency

Since @Deltakosh added “sound sprites” to BJS, I have been experimenting with the other functionalities of BJS’s sound capabilities. Some interesting features :slight_smile:

So I have been playing with “spatial audio” and looking at this Playground The music is attached to the box and as the cylinder and camera move away from the box the sound dies away - and it works well.

But what is the impact on scene efficiency? Is the code continuously checking how far the listener is from the box? And if you have 5 or 6, perhaps more, of these files playing is it weighing down the scene engine? In a big scene where one sound disappears and then another one starts does it lead to inefficiency?

Can they be turned off easily somehow without having to be constantly checking for the camera position as someone moves around a large scene?

cheers, gryff :slight_smile:

The code will be called every time the camera moves. But the operation itself is REALLY not expensive. It is just about getting a distance and updating webaudio code (which runs on a different thread)

So no worries. You can have plenty of them

1 Like

@Deltakosh TY for the quick and positive response David. Maybe one day I will post something where you will see it in action. And my sound sprites file is upto 9 sounds now :wink:

cheers, gryff :slight_smile:

Man! I want to see it asap :smiley: