Positional audio troubles

Hi.

I’m having trouble getting positional audio to work, all I get is ‘headspace’, no matter what I try.
I found this old thread: http://hub.jmonkeyengine.org/forum/topic/question-concerning-positional-audionode/ and tried to mirror the suggestions there but to no avail.
Facts:
I have a Listener.
I’ve tried having the AudioNode attached, detached, nested. Various forms of fall off.
Even TestReverb yields no audible change in location, despite multiplying the translation by large numbers.

Now, I’m using an SVN version which is a couple of months old, but I don’t see many changes to the audio code for quite a while.

Ideas?

Thanks

1 Like

My far-seeing goggles don’t work so well these days… so you might actually have to post some code because I can’t see it from here.

1 Like

Note: there were some changes committed to updateGeometricState() recently that “could” affect this… a quick skim of the code doesn’t show any immediate issues but it was worth mentioning.

Otherwise, as of a couple weeks ago, positional audio was working just fine.

1 Like
you might actually have to post some code because I can’t see it from here.

Here’s the complete code of TestReverb.java :wink:
It has a modification to make the position more extreme. Like mentioned, I’ve also tried nesting and such, but this should be the simplest case.
I was mostly interested in hearing if any others had had similar issues, or if it was a known problem.
Is it possible it’s a driver issue? I don’t remember the last time I had jME + position audio working on this sound card. Can’t remember if I’ve tried either.

package jme3test.audio;

import com.jme3.app.SimpleApplication;
import com.jme3.audio.AudioNode;
import com.jme3.audio.Environment;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;

public class TestReverb extends SimpleApplication {

private AudioNode audioSource;
private float time = 0;
private float nextTime = 1;

public static void main(String args) {
TestReverb test = new TestReverb();
test.start();
}

@Override
public void simpleInitApp() {
audioSource = new AudioNode(assetManager, “Sound/Effects/Bang.wav”);

float[] eax = new float[]{15, 38.0f, 0.300f, -1000, -3300, 0,
  1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f, 0.00f, 0.00f,
  -229, 0.088f, 0.00f, 0.00f, 0.00f, 0.125f, 1.000f, 0.250f,
  0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f};
audioRenderer.setEnvironment(new Environment(eax));
Environment env = Environment.Cavern;
audioRenderer.setEnvironment(env);

}

@Override
public void simpleUpdate(float tpf) {
time += tpf;

if (time > nextTime) {
  Vector3f v = new Vector3f();
  v.setX(FastMath.nextRandomFloat());
  v.setY(FastMath.nextRandomFloat());
  v.setZ(FastMath.nextRandomFloat());
  v.multLocal(1000, 2, 1000);

// v.subtractLocal(20, 1, 20);
audioSource.setVolume(0.25f);
audioSource.setLocalTranslation(v);
audioSource.playInstance();
time = 0;
nextTime = FastMath.nextRandomFloat() * 2 + 0.5f;
}
}
}

I just confirmed that position audio still works with one of my own app.

The only quick things I spot from your test case is that the sounds will all mostly be coming from the same direction relative to 0,0,0 (since you haven’t positioned the listener anywhere, that is probably where it’s sitting). You might have an easier time testing positional audio if you left the audio node in one place and moved the listener around… then work on testing moving audio. But random pops all over the place with a super amount of reverb as that example has is going to be nearly impossible to nail down.

…actually, with that much reverb it may sound like the sound is coming from everywhere anyway.