question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ogg files load way more slowly than wav files

See original GitHub issue

Issue details

The only change I make is to switch my sound effect folder all to .ogg rather than .wav and the load time difference is:

All wav sounds: assets 229 screen 441

All ogg sounds: assets 1548 screen 1749

The difference in loading time is somewhat noticeable anyway, but I’ve provided the actual times for clarity.

Reproduction steps/code

Load sound effects as ordinary Sound files as wav and then all as ogg and test the loading time of each.

Version of libGDX and/or relevant dependencies

1.10.0

Please select the affected platforms

  • MacOS

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:26 (14 by maintainers)

github_iconTop GitHub Comments

7reactions
Frosty-Jcommented, Aug 22, 2021

I feel like I’ve been to Hell and back, figuring out Unity. Think I’ve managed to conjure up an equivalent test - loading an AudioClip from outside the project (libGDX test was also external). I think it might be possible to shave off ~50ms from this, but you get the picture. Here’s the current score on the three:

Format libGDX ffmpeg Unity
16-bit WAV PCM 779 752 764
MP3 12196 3224 5717
OGG Vorbis 9745 3493 5593

libGDX is still the loser, but you need to be loading in an awful lot of audio in one go on desktop for it to really matter.

3reactions
badlogiccommented, Oct 22, 2021

Oh, hey, entitlement city! So, first of all. As Nate sad, the decoders for both OGG and MP3 are pure Java decoders. That means they will be slow until the hot code paths have been run a few thousand times until the JIT compiler of the JVM kicks in. No mystery, conspiracy, etc.

What could be done:

And since libGDX is such a nice open-source project, you can totally send a PR that swaps out the Java decoder for OGG for the stb vorbis decoder in LWJGL 3 instead of telling people actually contributing code to and maintaining libgdx that their comments are useless.

Read more comments on GitHub >

github_iconTop Results From Across the Web

File Explorer is slow showing properties for .ogg type files.
ogg file to view the properties, File Explorer freezes for over a minute before finally completing the action. This problem only appears with...
Read more >
Why are folders filled with ogg files so slow? : r/windows - Reddit
This is really annoying, especially when I have to access multiple folders. This delay doesn't seem to occur with other folders.
Read more >
How to improve load times of audio files without loosing too ...
Unlike MP3, OGG or WAV files, a MIDI file is not an audio recording. Instead, it is a set of instructions used to...
Read more >
Smallest audio file: MP3, Ogg, or Wav? - Stack Overflow
Of those three, Ogg would usually be smaller than MP3 . Both would be much smaller than the uncompressed WAV . Of course,...
Read more >
How to slow down audio files? [closed] - Super User
The recorded information is constant, this just changes how it is played back (and, thus, can make a recording sound slower).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found