Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Android framerate stuttering with sound playback.

Author
Message
agkcoder
19
Years of Service
Recently Online
Joined: 12th Dec 2004
Location:
Posted: 6th Jan 2023 09:40 Edited at: 6th Jan 2023 09:44
To all AppGameKit fellows who experienced this bug, and maybe did any investigation on this, please tell your findings.

Also could be interesting to know:

- Which AppGameKit version you compiled with?
- On what Android version you tried your code?
- What Chipset/SOC the phone had?
- How much RAM the phone had?
- The number of simultaneous sounds that started to cause problems?

Thanks for sharing.
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 6th Jan 2023 16:21
For me, the problem has surfaced on virtually every Android device I can recall testing, ranging from 4 through 11 with a wide range of processors and memory specifications. Also with every version of Studio I have tried. A more feasible question might be: What device(s) does it not occur on?

For the last question, it has been intermittent and varies in duration. The stutter occurs at pretty much every sound playback instance, but the severity varies. It may be a slight 10-20ms pause or it may be 100-250ms (with the same sound effect on the same device). Sometimes a severe stutter occurs on the first sound play, sometimes on the 5th or 10th, sometimes it remains short. But a hesitation always seems to occur consistently whether short or long.
agkcoder
19
Years of Service
Recently Online
Joined: 12th Dec 2004
Location:
Posted: 7th Jan 2023 10:24 Edited at: 31st May 2023 19:19
Thanks for the info SFSW!

I made a quick test code where 200 small sprites move from right to left with random position looped with one still background image. One OGG track plays in the background, and every time a pointer (screen, mouse) get pressed an explosion and a laser firing wav sound plays. I exported to Android with AppGameKit 2020.11.16 version.

Test 1

I installed it on a LG K4 1.1 Ghz Quad Core Cortex A7 - Adreno 304 with Android 5.1.1 on it. Everything was smooth, virtually no frame drop even with very fast tapping on the screen.

Test 2

Installed the same test code on a HUAWEI Mate 20 Pro Octa-core (2x2.6 GHz Cortex-A76 & 2x1.92 GHz Cortex-A76 & 4x1.8 GHz Cortex-A55 - Mali-G76 MP10 - Android 10.
Scrolling is smooth with background music only. Every time I tapped the screen all sprite movement froze for like 250ms. If it was a game of course it would be unplayable. I didn't experience this exact severe frame rate stuttering with AppGameKit on Android before because I only tested on my old LG where this issue seems not to be present.

Looks like something has changed in Android the way it handles audio?
SFSW
21
Years of Service
User Offline
Joined: 9th Oct 2002
Location:
Posted: 7th Jan 2023 20:48
Ironically, it does seem less pronounced on -older- devices. Not sure why, but for whatever reason(s), stuttering might be about 1/10 on older devices compared to newer ones. It may be more difficult to spot, but there always seems to be at least a slight delay (enough to throw off aiming in my projects at least). Previous discussions on the topic seem to indicate that the root of the problem might be due to the Android Studio player not threading audio playback, so a single thread has to try and manage everything in addition to any audio you try to play. So perhaps newer devices have some changes that make that process less efficient and weaker from a performance standpoint.
agkcoder
19
Years of Service
Recently Online
Joined: 12th Dec 2004
Location:
Posted: 7th Jan 2023 20:55 Edited at: 31st May 2023 19:20
Hm...

Login to post a reply

Server time is: 2024-04-27 00:02:36
Your offset time is: 2024-04-27 00:02:36