vanilla web audio api without any experimental and buggy howler or web audio api positional sound apis
This doesn’t make any sense. How can you not use position and create a spatial audio. Web audio uses position of the source and the listner to create spatial audio, that’s how spatial audio is done. HowlerJS is just a wrapper for AudioContext and it obviously will be buggy if you don’t set it up properly to make it compatible with GTA environment
You can create a spatial audio effect using the stereo API with panners. You’re just used to the simple way of making positional audio with just providing the vectors into the ,setPosition" of the listener and the player which makes the whole 3D effect glitchy and not smooth, especially if you want to keep the optimization.
As its mentioned in the topic, we’re doing our own math calculations to determine the L/R balance.
Well I’m not used to anything cause I don’t do spatial audio everyday, but it seems a bit misleading to say that you do not use positional api. Using panner node seems to be fine but it doesn’t mean you are not using positional api. You can’t just pan nothing. Anyways you do you. Have a good day
Yeah, using panner node is a way better solution than using the experimental positional API. And yeah, you don’t need a positional API to calculate the panner, distances and other stuff. That’s all possible with own math.
Would need a bit more info on this to see if this could get implemented on my project.
The most important feature i would need would be setting a min / max volume play on a 3D sound, not just being 1.0 at max / 0.0 at min.
Also setting the ‘size’ of a sound if i can call it like this. If for exemple i take an grenade explosion sound, i want to be able to set this sound to have a size of 2.0 where in this size, the sound is at max, then it’s reduced based on the distance.
Not sure if it’s very clear, i’m not sure myself how to explain it properly
You’re probably just overthinking it, that is doable with regular sound distance that turns down the volume depending on how far you are from the sound. There’s no need to make a size of a sound, I guess it would work something like if you’re inside the size the volume will be 1.0, and if outside it will start going down depending on how far you are, right?
What ? No that’s the default behavior of a 3D sound, i would hope your system have this.
I’m thinking of having different “type” of sound, for exemple if you play a song out of a speaker, the sound ‘size’ would be very small because it’s going out of a speaker. But the sound of an explosion is bigger, for exemple it would have a radius of 5.0 where in this radius the sound is still at 1.0 and then only outside of this radius it start decrasing the volume.
I tried existing solutions but none have this feature, so i’m better making my own
I guess it would work something like if you’re inside the size the volume will be 1.0, and if outside it will start going down depending on how far you are, right?
This part is right, this is what i’m looking for BUT with while controling the min / max volume of the sound, not just 1.0 / 0.0
hmm cant seem to get it to work right, its all loading and no conflicts i can see, but testing the car radio its very quiet when im outside with the door open. and how do i play youtube or mp3?
Hello I seem to be having issues playing sound files with looped set to true for both Play3dEntity and Play3dPos. Does this work or do I need to set up something for it to work?
I have an ambience script with an array of positions, file name, and distance and would be helpful to only iterate it once on init then have them loop rather than doing it the less efficient way of running it in a while loop ever X amount of seconds