Skip to content

FunkinCrew/FlxPartialSound

Repository files navigation

FlxPartialSound

Haxelib for haxeflixel for loading partial data from an audio file

Usage

// will load audio asset "assets/music/music.mp3" from bytes near 10% (0.1) of the audio lenght, 
// until the bytes around 50% (0.5) of the audio length
// which will return a Future<AudioBuffer>
var soundRequest = FlxPartialSound.partialLoadFromFile('assets/music/music.mp3', 0.1, 0.5);

// once it finishes loading, we can play it with flixel
soundRequest.onComplete(function(buffer:AudioBuffer)
{
	FlxG.sound.play(Sound.fromAudioBuffer(buffer));
});

Requires lime and flixel

TODO

See the Github Issues

Restrictions

Loading via percentage values

You need to load it via "percentage" values since:

  • Varying bitrates aren't supported, so it just gets the first "frame" of MP3 data it finds
  • sample rate also isn't supported yet.

So while it would be nice to supply it via milliseconds, that would require:

  • requesting the audio file
  • getting the file type (MP3 or OGG)
  • getting the sample rate data from the byte data
  • getting the bitrate data from the byte data

Further reading and research material

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages