How to load ogg files from user://

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

Hey, how do I load in OGG Vorbis files from user://? I can’t have the file under res:// since it’s from an external source.

Apparently you can do this with AudioStreamMP3 for MP3 files like this:

func load_mp3(path):
    var file =, FileAccess.READ)
    var sound = = file.get_buffer(file.get_length())
    return sound

but that won’t work for me since the files are OGG. Is there a way for me to load OGG files via FileAccess (perhaps setting the packet_sequence property on AudioStreamOggVorbis somehow?)

EDIT: I found a workaround but leaving this open because it is not a good workaround. if you have ffmpeg installed and on PATH, you can use it to convert to mp3 (via OS.execute()), and then load it. this works, but I shouldn’t need to explain why it’s bad.

:bust_in_silhouette: Reply From: GameSchool


With AudioStreamPlayer2D I managed to load an ogg file with the following code:

func _ready(): = load("user://untitled.ogg")

I don’t know if I understood you correctly, let me know if I didn’t