Crackling noise when moving ears

I’m experiencing a problem where the sound has a crackle in it when when the player is turning their head, the crackle is worse the faster the head is turned. See this video for what I mean:

Originally I was setting the listener location and rotation to the camera’s location and rotation but that seems to be happening automatically so I’ve now removed that

Here is how the sound is created

private AudioNode createThrustSound(String thrustSoundLocation, float volume){
    

    AudioNode audio = new AudioNode(Main.assetManagerCashe, thrustSoundLocation, DataType.Buffer);
    audio.setPositional(true);
    audio.setRefDistance(5);
    audio.setMaxDistance(10000);
    audio.setLocalTranslation(Vector3f.ZERO.clone());
    audio.setLooping(true);
    audio.setVolume(volume);
    return audio;
}

  //inside the thruster setup code
  thrustSound = createThrustSound(THRUST_SOUND_LOCATION,1);
  particlesNode.attachChild(thrustSound);
  thrustSound.play();

Any idea what might cause this?

Nb: I’m currently on 3.1.0-beta2-b001-SNAPSHOT if it makes a difference

Do you have vsync enabled? Having that disabled sometimes creates weird noises, especially when using integrated sound card.

But should it be audible when recording straight like that? Or only when listening from the speakers?

I’ve tried it both with and without vsync, and in fullscreen and not in fullscreen. Identical results in all cases

Probably not. Didn’t watch the video tbh.

Hmmm… This is weird. Your code also looks fine so far. You could try to use another sound file (maybe another format), just for testing, and see if this noise still occurs.

I’ve tried the built in test sounds Sound/Effects/kick.wav and Sound/Effects/Beep.ogg. Both give the same problem. I’m going to see if I can create a test program that displays the same results

1 Like

I’m fairly sure this is something to do with my hardware now. Basically the hello audio tutorial displays the effect (but with the sound exchanged for Sound/Effects/Beep.ogg which is more of a continuous tone which displays the effect most strongly. This will crackle if you spin your camera (the jme3-test-data library added for the sound) :

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.audio.AudioNode;
import com.jme3.audio.AudioData.DataType;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
//NOTE! Added the jme3-test-data library over standard libraries

public class Main extends SimpleApplication {

  private AudioNode audio_gun;
  private AudioNode audio_nature;
  private Geometry marker;

  public static void main(String[] args) {
    Main app = new Main();
    app.start();
  }

  @Override
  public void simpleInitApp() {
    flyCam.setMoveSpeed(40);

    /** just a blue box floating in space */
    Box box1 = new Box(1, 1, 1);
    marker = new Geometry("Player", box1);
    Material mat1 = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
    mat1.setColor("Color", ColorRGBA.Blue);
    marker.setMaterial(mat1);
    rootNode.attachChild(marker);

    initAudio();
  }

  /** We create two audio nodes. */
  private void initAudio() {

    /* nature sound - keeps playing in a loop. */
    audio_nature = new AudioNode(assetManager, "Sound/Effects/Beep.ogg", DataType.Stream);
    audio_nature.setLooping(true);  
    audio_nature.setPositional(true);
    audio_nature.setVolume(1);
    rootNode.attachChild(audio_nature);
    audio_nature.play(); // play continuously!
  }



  /** Move the listener with the a camera - for 3D audio. */
  @Override
  public void simpleUpdate(float tpf) {
    listener.setLocation(cam.getLocation());
    listener.setRotation(cam.getRotation());
  }

}

I’m assuming this doesn’t crackle for anyone but me

This is what my device manger says about my sound card, it seems oddly generic
Imgur

1 Like

I ran your code and observed audio noise when I rotate the camera. I wouldn’t describe it as a “crackle” – more like a brief pulse of low-frequency buzz, but it’s likely the same issue. So perhaps it’s not specific to your hardware.

1 Like

That’s interesting, I’ll stop reinstalling drivers in that case

I tried this test case too and also couldn’t hear any crackle. The sound is smooth except when the camera is moved and it becomes louder / quieter.