Wav to base64 string, do not decoding to audio

Godot Version

3.5.3

Question

So I got base64 string from my wav file with Marshalls.raw_to_base64(sound.get_data()) but can not decode it back to audio. Tried many online encoders, no one done. But when I encode my audio in any of this encoders it decodes back without any issues. Does anyone knows how to beat this?

get_data is only the sound data, not including the WAV headers. Godot’s docs describe more

So you are really encoding 8bit PCM data, not WAV data.

Thanks for answer. But how encode with wav headers? Is Godot classes have methods for this?

You might have to construct it yourself. Godot 3.5 can save wav files, but they do not expose a packed byte array.

Luckily it’s not too much work for a header, like the other old microsoft formats.

1 Like