Attention | Topic was automatically imported from the old Question2Answer platform. | |
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.open(path, FileAccess.READ)
var sound = AudioStreamMP3.new()
sound.data = 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.