3D sound volume

Hello guys,

I am working on a small game thingie in which I want to display a box with a sound attached to it. The camera will never move, and the sound should depend on the position of the box in the 3D world. I basicly attached a sound to a box like this:

        audio = AudioSystem.getSystem();

        String resource = "file:///"+System.getProperty("user.dir")+"/data/Footsteps.wav"
        AudioTrack sound = AudioSystem.getSystem().createAudioTrack(new URL(resource), false);

        RangedAudioTracker track = new RangedAudioTracker(sound);

I guess it works well, but the problem is that I do not know whether the sound is playing correctly, because the volume of it is really low. The difference between the box being in front of the camera and the box being further away from the cam should also be very much noticable, and the difference between left and right should also be very high.

I was looking at the documentation and noticed the sound system does not provide an awfull lot of explenation. I have been playing with this for about 2 days now, but I cant figure out how it should be done. Any help would be greatly appreciated!


Did you already check out jmetest.audio.TestJmexAudio?

Jep, that's where I started from

anyway, I got it somehow working. using trial and error I have been putting some random values and it seems to work quite nice now.

Another question: is it possible to alter the volumechangerate on the X axis independant of the Z axis?