This worked only for .ogg Files but not for .wav Files. Why?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Omstero

This Solution worked quite well for me. But only with .ogg files. The same solution with .wav created only a louad rustle. So i dont know why it does not work for .wav files?

I’ve tried and I got the same result as you. The .wav file loaded at runtime makes a lot of noise it’s horrible. I’ve compared the first few bytes to the same song, but loaded to AudioStremPlayer through the editor and they are not the same. Note that it works fine when loaded in the editor.

While searching for more I stumble upon this post https://forum.godotengine.org/67796/problems-when-importing-audio-files-in-runtime.

The guy created an issue describing the problem, and provided a gdscript to parse the wav header. It doesn’t work in my case, because the format code parsed was 3 which corresponds to nothing.

But you can try it for yourself.

Here’s the issue: Easily load external audio (WAV) files at run-time · Issue #732 · godotengine/godot-proposals · GitHub

And the script: https://github.com/Gianclgar/GDScriptAudioImport/blob/master/GDScriptAudioImport.gd

MrEliptik | 2021-05-05 23:18