Game severely lags after using .ogg (VBR) sound files

Greetings,

I have a big project which uses .ogg (CBR) files for musics and sounds. Performance was optimal. However, I decided to remix said sounds/musics and exported them to .ogg (VBR) instead. Now, everytime I launch a preview, both in-engine and Network Preview, the game has slowed down to a crawl.

I have a hunch that the cause for the lag is because I use the .ogg (VBR) files which are Variable Bitrates instead of CBR (constant bitrates).

The reason my project uses VBR .ogg files is because it takes less size than the CBR .ogg files.

Is this a bug?

I don’t want to re-export them to CBR again because there are so much sound files in my project. Is there anyone who can provide a workaround for this?

Thank you so much.

This is unlikely to be a bug in GDevelop at all. The game engine uses the system/browser APIs to play audio files (“WebAudio” API or “HTML5 audio” apis), and the worst that can happen is to mix between sound and music, which means that you would have a large audio file fully decoded in memory (if you use “play sound”) instead of streamed (if you use “play music”).

The actual decoding and play of the audio files is done by the browser or the device itself, so there is not much we can do.
Your feedback is interesting too.

Can you try with AAC format? AAC is generally supported by all browsers and operating system.

I agree with Florian that you will have a better experience with AAC files. They have great quality, are very small, and 96% of the devices in the world support it (Ogg only works on 80%).

Don’t worry, the conversion process will only take a minute thanks to the batch processing of free:ac (an opensource audio converter) https://www.freac.org/

I recommend using the quality setting of “3”. It still sounds great and keeps game downloads small and fast.

Good luck!

2 Likes

Hi @4ian & @tristanrhodes , after the past frustrating hours of restarting GDevelop a bunch of times and replacing audio expressions 10 times in the event sheets, I finally read your replies.

Thank you so much for the explaination regarding audio files and the suggestion of the .aac file format. This really helped me (and thank you @tristanrhodes for the link to the software!).

I have converted all .ogg music and sound files to .aac, and thanks to you now the game runs so much better almost with no lag.

The changes didn’t take effect immediately though (weird), so I had to restart my PC (not GDevelop) for the lagging problems to really disappear.

Thank you!

1 Like