Is it possible to implement music/SFX in game made using JMonkey? If yes, how did you do it? What did you use?


1 Answer 1



Admittedly I don't have a ton of experience with JMonkey, however this page seems to have enough information to explain the system.

From what I can read, JMonkey's audio system uses a listener/source system. Regardless, it seems simple enough to implement and should be a fairly trivial task.

Edit: After reading the article, I'll try to explain it more here:

Each sound uses an instance of AudioNode, created like this:

AudioNode nodey;

To load the sounds themselves, simply create a new instance like so:

nodey = new AudioNode(assetManager, "a-file.wav", false);

The true/false sets if the sound will be streamed or not. For long sounds (think things like in-game Music,) this should be set to true, however shorter sounds, this should not be streamed.

Once you load the sound, you can then attach to the root node, and then either play it using play() or playInstance():

/** Repeat playing if sound is ambient (Waterfall, wind etc.) [Note: nodey.setLooping(true) should be called before adding to the root node if the sound will loop] */
/** Play as instance (Footstep, Gunshot, etc.) */

For playback, a "listener" object must be created, and said "listeners" proprieties should be updated as the camera moves.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .