Best practices for sound effects, problems with stuttering

As I’m going to rework my audio system I want to ask a few things before I begin and mess up again.

The thing is that when I first added sounds for weapons one of the people that tested reported that everytime he fired (and an audionode instance played) his game would stutter as if the sound was running on the main thread, making it unplayable. After that I reduced the number of audionodes from one per weapon to one per ship which is dumb but it helped, although the problem was still pretty bad.

The problem is that I’ve never managed to reproduce it (it always ran fine for me) and I’m sure his PC isn’t the problem (he has an i5ish Xeon and a R9 280) and the sounds were buffered into the game and not streamed.

The tutorials never mention this, but am I supposed to make my own thread to play sound somehow? I can’t really see how that’d work though since the nodes have to actually be attached to the scene graph and fired from the rendering thread…

Audio playing happens on a separate thread, that won’t be the issue here. Sounds more like his sound card / driver / setup is.

I’m sure the first answer will be “but it works elsewhere” but that doesn’t say much unless “elsewhere” also uses OpenAL.

Oh, I haven’t thought of that, perhaps simply updating the drivers could work.
Btw how performace heavy are the audionodes for like 2 second .wav playbacks otherwise? I’m still not quite sure if I should use them super sparingly or is having a few hundred around alright?

There is a limit to the number of channels that will play at once. I don’t know what happens if you exceed it. 64 sticks in my mind but that’s just a guess-memory.

Ok, cool I’ll keep that in mind.

The cpu divides by zero, a black hole forms and consumes the planet. Or in the best case scenario it might just crash.

I don’t know if it ignores the 65th simultaneous sound or kills one of the old ones.

1 Like

Sounds are usually like not noticable in cpu load at all. I kinda guess his system has some problem with either openal, or some related driver.

You could try another game that uses openal as comparison OpenAL – Wikipedia
see the list below

Hmm, Minecraft is on that list and he never had any problems with that. If I were to speculate I’d say they have an audionode attached to nearly every entity, which brings it to A LOT of audionodes.

You are wrong, actually. There used to be large spontaneous lag spikes caused by audio subsystem in minecraft before it was kind of fixed.

Well i said it never happened on my tester’s pc, not in general. But that is quite interesting, I wonder if it was the same problem and how they fixed it.

Are you using jME 3.0 or 3.1? The audio system was reworked in 3.1.
Also, what operating system does he use?

You can increase the number of sources from 64 without any adverse effects, but in this case you mention it stutters which might be unrelated.