Gap when looping background music on Android

I am noticing a silent gap when loping the background music of my game on few Android devices. Below are the test results conducted on different Android devices:

  • Motorola 1st gen (Android 5.0): problem

  • Motorola 2nd gen (Android 6.0): problem

  • HTC Nexus 9 (Android 7.0): no problem

  • OnePlus 5 (Android 8.0): no problem

I am using SimpleAudioEngine for playing the background music. I have created my project using version 3.14. I have following questions:

  1. Are there any recent changes made to the simple audio engine to fix such issues? If yes, how can update it?

  2. What are the best practices to fix such device specific issues?

I would appreciate any suggestions and thoughts on this topic. Thank you.

For future, this is a workaround solution to fix this issue:

Try a different file format (ogg is the best imo) and using AudioEngine instead of SimpleAudioEngine.

Thank you for the reply. I tried OGG file with no success. I also used AudioEngine previously, but there were different types of issues on Android devices.

Oh, important question: how big is ogg file? If it’s over 128 kB it’ll have a gap. See this:

You can change the 128 limit in cocos2d-x source.