PositionalAudio but analyze volume and freq locally (not in reference to listener)

Hi everyone!

I have a world with objects and they have PositionalAudio working.
I want to move the objects a bit randomly every time certain threshold of volume is crossed (on the transients) of that object’s audio. I tried adding an analyzer like so:

let analyser = new THREE.AudioAnalyser( positionalSound, FFT_SIZE );

then in the update method calling:

console.log( analyser.getAverageFrequency() )

This works fine, but when I move closer or away from the object with my camera the volume is affected. Ideally, I would like to have positionalAudio working for the actual audio coming out of the speakers, but have global audio for that specific object’s audio-file influence its position, regardless where the camera is positioned.

What would be the correct way of doing this? Make an Audio and a PositonalAudio for the same object? Having two different listeners? How can I mute one Audio and only keep the ‘values’ it produces?

As you can tell, I’m a bit lost :slight_smile:

Any help much appreciated!

Thnx

Nope, since a listener represent the final destination of all audio in the web audio context.

I don’t think this works because you would hear both audios at the same time. If you mute the instance of THREE.Audio, the analyzer receives no data.

AFAICT, what you are trying to achieve is not possible. At least not with the API of three.js. There might be a way with pure Web Audio although I’ve never seen your use case before.

I was thinking the same, but was hoping for someone to prove me wrong :slight_smile:
A pitty!

Thnx for the info.