FlxSound problems, invalid sound

166 views
Skip to first unread message

Alx101

unread,
Sep 24, 2014, 12:05:21 PM9/24/14
to haxef...@googlegroups.com
Hi! I'¨m a new user to HaxeFlixel so this might just be incorrect usage, however I've tried all the official usage instructions. The problem is when using FlxSound in my haxeflixel game. I create a variable called whip:
var whip:FlxSound;

i set this variable using the following code:
whip = FlxG.sound.load(AssetPaths.whip__mp3);

and I make sure i have whip.mp3 in my sounds map.
When I go to call the play function using:
whip.play();

flash gives me an "Invalid sound" error. The sound loaded correctly, but it fails when it plays. I've tried to load the sound using whip.load(...) and also tried to  play the soound directly using FlxG.sound.play(...) but I always get the same error. I also tried using different sound formats but to no avail. What am I doing wrong here? I can't find anyone having the same problem using haxeflixel.

Alx101

unread,
Sep 24, 2014, 12:46:41 PM9/24/14
to haxef...@googlegroups.com
I solved it, for anyone who might encounter the same error I'll explain what went wrong and how to fix it. I only now noticed in the build log that it was unable to embed the mp3-file because the sample rate was too high, my mp3 file was at 48000hz while flash only supports 44100hz maximum. Therefore I got the invalid sound error. The fix was simple, just save the file at a different sample rate, which in this case was 44100hz for me and it worked beautifully.
Reply all
Reply to author
Forward
0 new messages