Sound --> Looped sound glitchy and crackling when app window has focus... (fine when not..?!)

So I have heard already that sound is in general quite broken.
But I still want to hear if someone has an idea.

So here we are on OSX 10.14.6 / Krom —> I have a short looped backingtrack, ~1mb.
(Tried all three formats & stream on/off)

When the game runs and the app-window has focus
it glitches and crackles all over the place.
(it sounds the same like when I produce music and the CPUs/DSPs are overloaded.
Sounds pretty much the same.)

When I focus another application
(blender, browser, email program, whatever) the sound is good and runs smoothly.
What the hell can that be? (

Also web is fine in general but I have read a lot about krom sound issues.
Just thought because that was way over a year ago, something might have changed already in that regard. Pretty disappointing.

Short sounds are fine on OSX/Krom though as far as I can tell (so far at least).

@Lytz1 Thank you for the info and testing. Is this game a simple default scene? If not what other modules does it have, such as physics, canvas, etc.

Hey there. Thanks for answering. No, it’s not a default scene.
For now it’s basically a titlescreen and a main-gamescene with
an already playable game.

Not too much is happening though in the gamescene at that point,
a couple of rb’s, active, passive,
around 20.000 tris (incl. shadows), 43 draw calls,
stable frame rate @60fps.

Physics are on, canvas is there (two separate ones, one on the title screen, the other one on the gamescene) .

I also noticed that when I put the sound on a script attached
to the titlescene, it is all good… When the scene gets changed to the gamescene tough, it glitches out again.

Also it seems to be with shorter ones as well. I should have
noticed that before. Not sure why I didn’t.

(Interesting that you mentioned physics, because I think physics
are not enabled on the titlescreen, where all is good soundwise.)

I’ll try tomorrow a clean armory .blend from scratch,
add sound first and then add stuff one by one after that.

Then I will see how far I can go until this crackling happens. Might be a better way to track this down. If it happens right away, I will report on that as well.

1 Like

Short follow up:
I added the backing sound on top of the sound demo scene.
There it works fine. So I need to see what is causing this in my project.
That’s probably good news, so I think this is solveable.

The glitchyness is also clearly more intense when more canvas elements are on the screen.

I can’t turn neither zui nor physics off without the whole codebase breaking though. I need to think about how I approach this.

So I found it: Somehow it’s the canvas. I dont know why this is even possible.

I deleted everything down to no scripts at all and removed nearly all geometry,
so all that was left in the game scene was only a plane.

Still, the glitches and crackles were there.

So I deactivated the canvas in the game scene and the glitches and crackles disappeared.

(There are only textobjects in that canvas (8)
and two buttons. That’s it…)

Yeah. It’s the number of textobjects. When I reduce them, it gets better.
When there are just a few, all is good.

I have no idea why this is or what can be done about that.
I hope someone can test this as well and I hope this is reproducable.

(when I spam text in the title scene, which was fine before all the time, the same happens.
So clearly this is bound to the amount of textobjects on the canvas. No doubt about that…)

Zui canvas has a reputation for reducing performance for some reason, although specifically made “light-wight”

Apparently, it also behaves differently on different Android devices.

Also, does Physics affect the audio play-back

Hmm… I see… Why only in Krom though? Html seems perfectly fine.
Maybe Kroms performance is so bad?

But just a couple of text boxes really shouldn’t break the audio…
Also, why is it only the audio then? And not the general framerate or any other part of the game?

(Regarding physics: I can’t see physics affecting audio in any way for now, maybe that
shows up later when more is going on in the scene though… )

You think that replacing text with drawing it in Kha g2.graphics directly might help?