Crackling of sound - HTML5 bundle (DEF-2515) (SOLVED)

Some of people who played our demo report about crackling in our music.

It isn’t reproduce on my mac, but it 100% on android chrome (I know that it official unsupported) and on some PC with windows 10 and 8.1 (any browsers).

Data of music track (ogg):

Demo: http://bring-me-cakes.com/demo/

4 Likes

I can confirm that there’s some crackling on Android Chrome, but it’s as you say an unsupported platform. The game plays remarkably well on a phone btw!

2 Likes

Yes, I know. But the same crackling on windows pc - thats the issue.
I told about android only like a fast way to reproduce if you have no windows pc near.

Yup, I didn’t mean to sound as if there was no issue :slight_smile: Would you mind sharing the ogg so that we can try to reproduce and investigate?

1 Like

yes, of course.
I will send you PM

UPD:
@britzl
Clean project has same issue
http://agulev.com/html5/test/

Created a ticket: DEF-2515

1 Like

Any Wav file on windows produces this for me, ogg is fine.

I get this on Android (and html5). I originally thought it had something to do with the browser turning on and off its sound, because it didn’t happen when there was continuous sound playing. I forgot about it because I solved the issue by looping a silent audio clip forever.

2 Likes

https://d954mas.itch.io/ld42-spaceship same problem

2 Likes

https://notbadgun.itch.io/junkyard same problem! crackling in music!

2 Likes

@inactive-vilse, ideas?

Will need to investigate, but if the music is playing continuously and crackling it is possible that the sound thread does not fill in the sound buffers fast enough.

We do release audio focus when there is silence, but if there is constant music playing it should not come into effect.

Defold should encode sounds to .WAV/.MP3/.OGG/(.M4A?) and use high-level HTML5 APIs for audio playback.

Otherwise we’ll always hear cracklings.

Defold should encode sounds to .WAV/.MP3/.OGG/(.M4A?)

We already do decode from WAV and OGG.I’m guessing it’s not really a performance issue (e.g starving), but an actual bug somewhere.

2 Likes

Looks like Defold was directly ported to HTML5 by the use of Emscripten.

Does Defold use OpenAL for audio playback? Emscripten emulates OpenAL behavior by filling WebAudio AudioContext’s buffer every frame.
=> We’ll always hear cracklings because of inconsistent HTML5 frame time.

A clear example of the problem (Emscripten + OpenAL + OGG music):

6 Likes

@ross.grams, just to be clear here, do you get it when you bundle for Android or when you use a browser on Android?

Wan’t to make clear if this problem only manifests in browsers or on other platforms as well.

It might be that there are two things at play here, when you loop the silent audio clip I assume the gain for that sample and the group channel are not zero right? It is the sample data that is silent?

1 Like
  • It was when I bundled for Android.
  • Yes, the sample data was silent, the gain was left at default.

That was a long time ago, and the Android device I used was also fairly old, so I wouldn’t worry unduly about that report if you can’t reproduce it.

1 Like

The crackling sound issue in HTML5 should be fixed in the next release, thanks for all the input.

14 Likes

Fixed in 1.2.135

3 Likes