Sounds randomly not loading for windows target?

So I’m not sure what’s going on, but about 1 out of every 10 exports for the windows/cpp target result in my audio files not being loaded. I receive a multitude of errors along the lines of:

Sound.hx:96: Error: Could not load “audio/sfx_strike.ogg”

As you can see all of my sound files are in the ogg format. I import all of them via Utilities.loadAudio(); at runtime. After some searching I noticed a comment stating that mono formats were ‘better,’ (
but didn’t really specify if this was necessary or not. Is this a known issue at all?

-Should I be converting them to mono?
-Should I use a target bitrate?
-Should I import them in a different manner?

I’m having this same problem and can find no pattern or cause.

Mono is better for OpenAL because it uses less memory and handles the sound position value properly. I’m not sure why this would be happening, if its within OpenAL or elsewhere, or perhaps if something on your system is leaking file handles, so the OS won’t release the file?

I flattened everything to mono with a batch process in audacity. The issue has yet to present itself again but it’s always so hard to tell with something that is seemingly random. I’ll keep you guys updated.

One thing to note- I tweeted to lucas pope (papers please dev) about the issue and he suggested using .wav files. Seems to be excessive but I’ll keep it in mind I suppose.

Using OpenFL 1.2.0.
I have the same problem, but both with wav and ogg files. Ogg is actually even worse because it freezes the game while wav just skips playing it.

Here is the full description of the problem :

  • there is 4 music tracks in the project
  • no matter which one I play first, it will work fine
  • the next track I play will never work, it gives error Sound.hx:96: Error: Could not load …
  • but if I try to play again the first track, that one will work again !
  • on Flash everything works fine, problem is Windows target
  • sound effects work / don’t work randomly

I tried using Audacity and exporting with signed 32bit PCM encoding, but it didn’t help.
Anyone have advice how to fix this because the game is already finished and I need to release it on Steam so it is super important to make this work ?


After trying different encoders, formats, xml settings like “music” flag, I found the problem and solution.
Problem is when two BIGGER sounds ( music tracks ) are played FIRST TIME and IN THE SAME FRAME.
So playing music for first time with 1 frame between them solves the issue.
After music or sound was played once normally, it is possible to play them normally even in the same frame. On the other hand, if it fails once, it will never work after.

As for the smaller sounds, I believe this problem could happen if too many of them are played at once.

EDIT2 : tested now newest OpenFL, everything works there normally, but this is a bit older game, so I need to stay on old version.

Yeah, I’ve found that loading too many sounds on the same frame (even smaller files) will cause issues on windows. my solution was just to load at the time of need.

I have the same problem. :smile:
I am also using openfl-native 1.2.0. Since it would be really big job to port the whole project to new OpenFL, is it possible to port only audio part? What exactly was fix for this problem?

Could you please share any issues you have that prevent moving to the latest OpenFL, using -Dlegacy? Would be helpful to get this feedback, as “legacy” is meant to be like openfl-native :wink: