Binding footsteps to a player (3daudio)

I’ve been expirimenting a bit with positional sound. Using the audio3d manager, as described here, I used the following code to mount a footstep sound to my player model:

audio3d = Audio3DManager.Audio3DManager(base.sfxManagerList[0], camera)
        SOUNDPATH = ConfigVariableString("soundpath","").getValue()
        runSound = audio3d.loadSfx(SOUNDPATH + 'run.wav')
        walkSound = audio3d.loadSfx(SOUNDPATH + 'walk.wav')
        audio3d.attachSoundToObject( runSound, self.actor)
        audio3d.attachSoundToObject( walkSound, self.actor)
        self.runInterval = SoundInterval(runSound, volume=1.0, name='play_' + "run")
        self.walkInterval = SoundInterval(walkSound, volume=1.0, name='play_' + "walk")

However, when I actually use it, using the code below, the sound changes in a strange way when I use my chasecam. Instead of being globally the same at every moment, The sounds get louder when I walk in the global direction of where the player spawned and dies out when I walk the other way.

        if ((self.keyMap["forward"]!=0) or  (self.keyMap["backward"]!=0) or (self.keyMap["left"]!=0) or (self.keyMap["right"]!=0)):
            if self.isMoving is False:
                self.actor.loop(self.moveAnim)
                if self.moveAnim == "walk":
                    self.walkInterval.loop()
                    self.runInterval.finish()
                else:
                    self.walkInterval.finish()
                    self.runInterval.loop()
                self.isMoving = True
        else:
            if self.isMoving:
                self.actor.stop()
                self.actor.loop("breathe")
                self.walkInterval.finish()
                self.runInterval.finish()
                self.isMoving = False

It looks a bit like te source of the audio is not connected to the player or something. Am I missing something?

ahum cough
I just discovered I missed the ‘right’ stereo channel.
Maybe this code can be of use to someone :slight_smile: It works great :slight_smile:

How about posting the complete code so other beginners can learn from your mistake.

this is all the code that has anything to do with the 3daudio part. The complete program is not in a state in which i’d like to showcase it at this time. Maybe around januari :slight_smile:

(on a sidenote, we decided to remove the 3d aspect from this part of the game, since it just does not add to realism in this perspective)

i want 3d footsteps :frowning: