I guess the main issue is representing behind and front? I guess a simple solution is to remove some of the higher frequencies when the baddy is behind.
Well with a stereo signal you are a bit limited, so probably the best way is to over do it, so over exaggerate the physical way our hearing works
So you could define a baddy from the listeners perspective with three variables (I don’t think you need X&Y?).
Angle from player
Distance from player
Velocity towards player
Distance determines volume, maybe also velocity as well, their footsteps get closer together and louder the faster they go?
The angle can maybe determine two low pass filters, two delays and two levels on your stereo channels.
If we say that 0 degrees is directly in front of you then you have no delays and no filtering.
At 90 degrees off to the right you have a small delay on the left channel and also some filtering and a bit less volume. Same with 270 degrees but the other way round. At 180 degrees behind you would filter both channels but no delays and a bit less volume. So you need to determine an algorithm based on angle that sets these 3 parameters for each channel, left and right.
You can also use the velocity to implement a Doppler effect, possibly only useful if you could dodge the baddy and it went flying past you. That would be neat rather than blocking maybe? Not much use I guess if they are slow moving though?
Look up binaural algorithms for lots of details and complexity or mess around with those filters, delays and levels until it works
You can “bodge” the complexity though, for Doppler the faster the baddy is coming towards you the higher you make the frequency of its sounds, the faster it is going away from you the lower you make the frequency of its sounds.
The “bodge” for the binaural stuff is the filters, delays and volumes I listed before.
revisiting this thread with the spatial rotator object test. i think if an enemy is coming the left, there doesn’t need to be any sound coming from the right channel. now i’m figuring out how to mimic sound coming from behind. will try your filter and delay methods soon.
also thinking of how the enemy will sound. i’m thinking something like the monster from Amnesia: The Bunker.
in the end I still used X & Y axis to determine sound from left or right, from behind or in front. just need to find a way to convert XY into angle. I already have the distance parameter
used polar2cartesian for angle & radius to X Y position
for Gills
twisting encoder now mimics turning your head
press encoder to fire the gun
current issues
sample sounds different when played through table/play
when barking is on the left ear, there are phase issues, but normal ears dont behave like this
so far I got the gun system and 3D audio system working. right now I’m thinking of using a wavetable as a map for the player to walk and navigate. and the tutorial level (first level) will just be a long hallway with a door at the end and sounds of flies flying around a corpse. no guns during the beginning of the game.
I saw somewhere online that you can draw wavetables, but is it possible to pinpoint a location on the wavetable? I can figure out the movement aspect later.