Skip to content

A script in GDScript for importing .wav and .ogg audio files at runtime

License

Notifications You must be signed in to change notification settings

Gianclgar/GDScriptAudioImport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

GDScriptAudioImport

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.

Usage instructions and example

  1. Import the script in to your project
  2. 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()

TODO:

  1. Test with very different wav files in order to see if format parsing works for different chunk sizes (doesn't seem to)
  2. Create a light version with only what is needed to set the AudioStreamSample
  3. Complete the "full version" - Keep it big for learning/referencing purposes
  4. Make it as a script Plugin
  5. Look for more efficient ways to parse the data and update it.
  6. Hope Godot Community and devs include a ´.wav´ importer at runtime that works at least as fine as the .ogg importer

About

A script in GDScript for importing .wav and .ogg audio files at runtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published