Hi all,
I tried getting into jMEs way of playing sound effects, but somehow it doesn´t work well…
I have a simple audio sample (.wav format, but it happens with other samples in the .ogg format too) and while it sounds pretty normal when playing it with windows media player, winamp or audacity, when I play it with jME, the sound is strangely distorted.
Too bad I can´t upload the original sound and a recording of the actual here but it sounds a bit like there may be little pauses in between… or somehow there was the wrong frequency used… or maybe even vibrating? … it´s hard to describe.
So that you have as much info as possible: It´s a mono audio file, 11025Hz frequency and audacity says 32-bit float.
The important parts of my code are here:
[java]
//…
private AudioNode audio_step;
private long timeFootstep;
public SoundManager(Main m) {
this.m=m;
initSounds();
}
private void initSounds() {
//...
audio_step = new AudioNode(m.getAssetManager(),"Sounds/step.wav",false);
audio_step.setPositional(true);
audio_step.setUserData("name","step");
m.getRootNode().attachChild(audio_step);
}
public void playFootstep() {
if (System.currentTimeMillis()-timeFootstep>1000) {
audio_step.setLocalTranslation(m.getCamera().getLocation());
audio_step.playInstance();
timeFootstep = System.currentTimeMillis();
}
}
[/java]
playFootstep() is called from time to time by another class.
Do you know what I could be doing wrong?
Or maybe you have a guess on what should be tested?
Thx in advance