Sound loop is not seamless in BGE

I’ve created a perfectly looped sound file, but when I import it in the BGE it doesn’t play seamlessly. There’s a 0.1 second pause that well, the game can live with it, but if it can be fixed it would improve the game no doubt, specially for 3D Sound areas.

I know nothing about Python, so if the only way of doing this is by means of a script I’d REALLY appreciate a very detailed explanation…

Thanks everybody for your time!

Well, if I was doing a perfect loop sound I will first set an always sensor >> AND >> play sound (loop stop) and then select the sound.

Try to set your actuator to constantly update, clicking on up arrow and leaves the steps as 0.

Thanks for your answer! Yes, this is exactly how I have it, but still there’s this slight silence before resetting the loop. I’ve tried different methods but nothing will fix it.

There are a couple of looping audios and it happens the same to all of them. I’m working with .mp3 files, I don’t know if maybe I should switch to another format that Blender deals better with or something.

I belive that this actuator needs to check if the sound is playing or not, that’s why the little pause you hear, but there is some workarounds for this:

  1. Try to create a sealmess sound that fade in and fade out, in the start and the end to make a smooth transition. This one is recommended because it causes only a little if no difference for the player, at least when I apply an ambient sound on my games I do in that way.
  2. That includes the first workaround, but if you want to make a constant noise, for example, do this setup:
    2.1 Make a seamless fade in and out sound.
    2.2 add a Always sensor and click on the up arrow to make it refresh at runtime.
    2.3 Add a sound actuator (play end) with your sound.
    2.4 Between the always sensor and sound actuator, you add an expression condition, its pretty easy working with them, even if you know almost nothing about programming is worth trying to learn.
    2.5 Create a float property called T, define it as a timer, and another one called maxT to specify when the sound needs to play again in seconds (just before the last one ends, to mantain the loop and avoid silence moments)
    2.6 The expression in the middle is: T > maxT
    Is an if condition, if met, the sound actuator will be executed.
    2.7 Adds a property actuator to set T value back to 0, to make a loopable event.

If you do it right your sound will always be executed correctly and the fade out of the last sound will be conected with the fade in of the next sound. Keep in mind that I already experienced some sound and time divergences because timer variables and sound aren’t synchronized.

1 Like

Hey that method with the fading sound seems workable! I’ll definitely try it, don’t think I’ll have trouble with it. Thanks!!

It worked! Had to do it with two different objects because for some reason I’m unable to make one same object repeat a sound over itself. But yeah it was as easy as setting up a property that lasts 1 second less than the audio (0.5 seconds for fade in and 0.5 for fade out) and toggling a Boolean so that it stays one round with sound and another silent. Thanks again, Makata!

1 Like