I’m testing audio-stream-plus, a GDExtension that provides FLAC and OPUS AudioStream support. The addon specifies that I use load() within GDScript to load these new AudioStream resources, which works fine. Oddly, if I drag & drop the resource into the stream of an AudioStreamPlayer2D, the debugger complains
_load: No loader found for resource res://song.opus (expected type: AudioStream)
I’m pretty new to Godot still, but this just doesn’t really make sense to me. How can load() work in script, but the inspector doesn’t? Shouldn’t they do the same thing?
From what I’m able to tell from my limited knowledge here, it seems like they indeed just didn’t include that function, thanks for pointing me in the right direction. Newbie perspective, but I don’t think it makes a lot of sense for these things to be different.
AudioStream et al is a group of super convoluted C++ classes. It may just be that they didn’t think the work was worth it for them.
One solution is to use Audacity to convert music into a format that’s supported by Godot. Opus is the successor to Vorbis, but it’s only really benefit is if you are streaming audio over the internet. This is the solution I would recommend.
Again, I don’t know why you’re using Opus, so if you’re using Godot for VoIP or streaming music, ignore me.
Another possible solution is to make your own fake loader. Create a tool script and add it to whatever you want to load your song into. Then export a file (@export_file). Then tie some code to that to load the file in code and problem solved.
Mostly just testing it as an experiment. Opus compresses much better than Vorbis, one of my soundtrack files is ~10MB as Vorbis, but only ~3MB as Opus, while still being transparent. I’m fine using Vorbis if I must, but I don’t wanna leave easy optimization on the table like this, if it’s an option.
Making a fake loader is a good idea. I figured out that I can save it as a resource file .tres and load it that way as well, so making it a tool script shouldn’t be hard. I’ll give that a try and report back, thanks!
Yeah I’ve used the Resource file approach. In fact it’s what I do now to store sound file info I can’t get. Except that as of 4.5 beta3 I can get those now, so I’m thinking about revamping the system. Still if you want to take a look at it, the code is open source and available as a plugin here.