What happen? Audio Help

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
com.jme3.asset.AssetLoadException: An exception has occured while loading asset: Sounds/ZombieSound.ogg (Stream)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:290)
at com.jme3.audio.AudioNode.(AudioNode.java:145)
at com.jme3.audio.AudioNode.(AudioNode.java:157)
at DodgePack.Main.initAudio(Main.java:367)
at DodgePack.Main.simpleInitApp(Main.java:75)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:744)
Caused by: de.jarnbjo.vorbis.VorbisFormatException: The file has no commentHeader.
at de.jarnbjo.vorbis.VorbisStream.(VorbisStream.java:99)
at com.jme3.audio.plugins.OGGLoader.load(OGGLoader.java:262)
at com.jme3.audio.plugins.OGGLoader.load(OGGLoader.java:295)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:288)
… 8 more

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.audio.AudioNode;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;

/** Sample 11 - playing 3D audio. */
public class Main extends SimpleApplication {

private AudioNode zombieSound;
private Geometry player;

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);
player = new Geometry("Player", box1);
Material mat1 = new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.Blue);
player.setMaterial(mat1);
rootNode.attachChild(player);

initAudio();

}

private void initAudio() {

/* zombie sound - keeps playing in a loop. */
zombieSound = new AudioNode(assetManager, "Sound/ZombieSound.ogg", true);
zombieSound.setLooping(true);  // activate continuous playing
zombieSound.setPositional(true);   
zombieSound.setVolume(3);
rootNode.attachChild(zombieSound);
zombieSound.play(); // play continuously!

}

@Override
public void simpleUpdate(float tpf) {
listener.setLocation(cam.getLocation());
listener.setRotation(cam.getRotation());
}}

It’s not a code problem. The error indicates that your .ogg file is not compatible with the ogg library… maybe it’s a bad file.

I only convert it
where can I find a good .ogg file?

Just use audacity and convert to a WAV: 16-bit signed PCM, mono.
That always worked for me.

what happen?

Only mono audio is supported for positional sounds.

1 Like

thanks btw.