A script for Godot in GDScript for importing .wav (via parsing the wav header), .ogg and .mp3 audio files at runtime.
I'm sure there's way more efficient ways to do this, but for me this works so far and it's my little baby.
- Import the script in to your project
- When you want to load you can call the class:
var music = AudioStreamPlayer.new()
var audio_loader = AudioLoader.new()
music.set_stream(audio_loader.loadfile("/path/to/song.ogg"))
music.volume_db = 1
music.pitch_scale = 1
music.play()
- Test with very different wav files in order to see if format parsing works for different chunk sizes (doesn't seem to)
- Create a light version with only what is needed to set the AudioStreamSample
- Complete the "full version" - Keep it big for learning/referencing purposes
- Make it as a script Plugin
- Look for more efficient ways to parse the data and update it.
- Hope Godot Community and devs include a ´.wav´ importer at runtime that works at least as fine as the .ogg importer